Was doing a sample free response test and I hit a question where it seems impossible to fulfill all the required postconditions.
Problem 3. (b), on pages 9-12 here:
http://www.collegeboard.com/prod_dow...ter_sci_ab.pdf
I'd copy and paste the text but my adobe reader does not want to seem to cooperate.
Anyways, basically the writer needs to implement two methods of a WaitingList which is a singly linked list class. The second (b) not yet made method when given another linked list and a number of nodes to copy, cuts the last n nodes to the current list.
The problems are that
a) the sizes of the two WaitingLists (as stored in the numNode variable) after moving the nodes must be kept correct.
There is no way I can find to modify the private numNode variable of the passed list. I ended up creating a method that allows the list to be resized but I was only told to make one method.
b) if one is told to move all the nodes from the second WaitingList the list must be made empty
once again there is no way to do this. The WaitingLists keep the references to their front nodes as private variables and there is no way to change these instance fields to null without creating a third method
Is there something I am missing, or is the problem flawed? Cause since this was on the 2006 test one would think that it would have a proper solution. Or are you allowed to create three methods in problems that only call on you to make one?