Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 160
» Latest member: zezima
» Forum threads: 324
» Forum posts: 1,084

Full Statistics

Online Users
There are currently 4 online users.
» 0 Member(s) | 4 Guest(s)

Latest Threads
Big Arithmetic and Time C...
Forum: Assignment 2
Last Post: SSinischo
5 hours ago
» Replies: 2
» Views: 47
#1 Fall 2016 Exam 2
Forum: Exam 2
Last Post: frostymelonade
7 hours ago
» Replies: 1
» Views: 24
Assign 2 typo
Forum: Project 2
Last Post: cmaugustine
8 hours ago
» Replies: 0
» Views: 7
Due date
Forum: Project 3
Last Post: cmaugustine
8 hours ago
» Replies: 1
» Views: 19
Checking for root
Forum: Project 2
Last Post: cmaugustine
8 hours ago
» Replies: 0
» Views: 8
#1 Confusion
Forum: Assignment 3
Last Post: davidmccoy
9 hours ago
» Replies: 0
» Views: 5
Memoization/Dynamic Progr...
Forum: The C Programming Language
Last Post: ianbway
11 hours ago
» Replies: 2
» Views: 55
Odd...slightly off number...
Forum: Project 1
Last Post: sammaryland
Yesterday, 06:57 PM
» Replies: 3
» Views: 61
Last semester's exam
Forum: Exam 2
Last Post: lusth
10-17-2017, 07:45 PM
» Replies: 0
» Views: 14
% calcuation in c
Forum: Project 1
Last Post: ianbway
10-17-2017, 07:40 PM
» Replies: 1
» Views: 32

 
  Assign 2 typo
Posted by: cmaugustine - 8 hours ago - Forum: Project 2 - No Replies

It says at the top of the gt.h file :
   /*** red-black binary search tree class ***/

Print this item

  Checking for root
Posted by: cmaugustine - 8 hours ago - Forum: Project 2 - No Replies

I'm working on the RBT module and I need to access the root value in an if statement. I see a function for setting the root, which I do use eventually, but how should we get the root as it should be private ? Am I overlooking something?

Print this item

  #1 Confusion
Posted by: davidmccoy - 9 hours ago - Forum: Assignment 3 - No Replies

In the longer example provided, how would we make the call in main? It looks like we could have a variadic number of expressions we need to read in based on the example, so I wanted to clarify.

Code:
(define (f x)
        (define (g y)
            (define zz 3)
            (staticScope 3 this)
            (+ x y)
            )
        g
        )

    (define z (f 3))

    (z 4)

Would this be the correct way to input the above function/calls?

Code:
$ echo "(define (f x) (staticScope 1 this))" > task1.args
$ echo "(define z (f 3)) (z 4)" >> task1.args
$ scam -r task1.scm task1.args
    #[environment L0]
        y : 4
        zz : 3
    #[environment L1]
        g : #[user defined function (g y)]
        x : 3
    #[environment L2]
        f : #[user defined function (f x)]
I'm a little lost, though. Are we reading the args until EOF?

Print this item

  Due date
Posted by: jaw653 - Yesterday, 02:13 AM - Forum: Project 3 - Replies (1)

The schedule currently says this project will be due a week after assign2. Is this correct?

Print this item

  Big Arithmetic and Time Constraints
Posted by: SSinischo - 10-17-2017, 11:34 PM - Forum: Assignment 2 - Replies (2)

Will our tasks 9/10 be under time constraints?  i.e. for multiplication and division, is "repeated addition/subtraction" a viable method to use, or would this take too long for tests with really huge integers?

Print this item

  Odd...slightly off numbers
Posted by: jaw653 - 10-17-2017, 09:55 PM - Forum: Project 1 - Replies (3)

I am getting the correct postfix output but my decimal answers are off by a few digits (like insignificant digits at the end of the decimal). Plus this only happens for the much longer tests. The expected answer will be something like 8.13500 and my answer will be something like 8.13480. Any ideas for how to fix?

Print this item

  Last semester's exam
Posted by: lusth - 10-17-2017, 07:45 PM - Forum: Exam 2 - No Replies

wget beastie.cs.ua.edu/cs201/last-2.pdf

Print this item

  % calcuation in c
Posted by: rcfrederick - 10-17-2017, 06:05 PM - Forum: Project 1 - Replies (1)

My understanding from online searching is that modulus in c can only be calculated on integers. In my project, I converted my doubles to integers assuming there was not another way. After seeing the results of Assign 1, I now know it can be calculated on doubles but I still don't know how. Can anyone help me?

Print this item

  Valgrind (A REALLY useful tool in figuring out your problems)
Posted by: clalexander4 - 10-17-2017, 02:18 PM - Forum: Project 1 - No Replies

So after class today, I spoke with Dr. Lusth about my valgrind output and he asked that I post it to the forum for everyone to use. It's basically a tool that will force your program to continue to execute so that you can find a good majority of your problems within your code.

You can find out more about it at:         http://www.valgrind.org
And after you download it, just use the command:          sudo apt-get valgrind 

to install it in bash. It has been super helpful to me in finding out where my issues are without hours of stressing and not seeing the obscure problems.

Good luck in the rest of class guys  Smile Heart

Print this item

  3.1.2 make-account Local State Problem
Posted by: davidmccoy - 10-17-2017, 03:59 AM - Forum: Exam 2 - No Replies

Using the implementation for make-account on page 223, I added the following condition to dispatch (my full edited program):

Code:
((eq? m 'show-balance) show-balance)

And I made show-balance the following:
Code:
(define show-balance (inspect balance))

When I ran this main function though...
Code:
(define (main)
   (define myAccount (make-account 100))
   ((myAccount 'withdraw) 50)
   ((myAccount 'deposit) 10)
   (myAccount 'show-balance)
   )

I got "balance is 100" instead of 60. Sad
When I changed my show-balance as follows:
Code:
((eq? m 'show-balance) (show-balance balance))
(define (show-balance balance) (inspect balance))

I got "balance is 60", as expected.

What's going on here? withdraw and deposit are able to reference the local environment's state of balance correctly, while show-balance seems to need to be passed the value. What gives?

Print this item