20.1, 20.2

0 views
Skip to first unread message

Andrew Haddock

unread,
Dec 2, 2011, 3:03:41 PM12/2/11
to byu-cs-jm-142-fall-2011
So what is the difference between modifying the array and modifying the Posns in the array?  I finished with 20.1 and realized that it fulfilled the requirements of 20.2 better.  I think I understand the difference between 20.1 and 20.2 to be that 20.1 uses the syntax new Posn(...) and just modifies the pieces, whereas 20.2 modifies the the whole Posn within the array.  Am I understanding that correctly?  

Jay McCarthy

unread,
Dec 2, 2011, 3:05:38 PM12/2/11
to byu-cs-jm-1...@googlegroups.com
Yup


On Fri, Dec 2, 2011 at 1:03 PM, Andrew Haddock <andrew.h...@gmail.com> wrote:
So what is the difference between modifying the array and modifying the Posns in the array?  I finished with 20.1 and realized that it fulfilled the requirements of 20.2 better.  I think I understand the difference between 20.1 and 20.2 to be that 20.1 uses the syntax new Posn(...) and just modifies the pieces, whereas 20.2 modifies the the whole Posn within the array.  Am I understanding that correctly?  



--
Jay McCarthy <j...@cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

Andrew Haddock

unread,
Dec 2, 2011, 9:55:40 PM12/2/11
to byu-cs-jm-1...@googlegroups.com
Hey, for 20.4, is it valid to have a return ; within the code of a while loop?  I tried mutating the key until it matched the target, but it got really complicated.  I'm wondering this because once we return something, I don't think the while loop actually repeats, and I don't know if that's "breaking the rules" or something.  But I got the function to work right by doing it this way.  Is that ok?  

Jay McCarthy

unread,
Dec 2, 2011, 11:42:42 PM12/2/11
to byu-cs-jm-1...@googlegroups.com
I don't know why you would be using a while at all on this exercise.

You should change your number #3 to mutate the value rather than return a new tree... that's all.
Reply all
Reply to author
Forward
0 new messages