I recently completed this assignment and there was this one bonus question that has been bugging me ever since.
Here's the problem (in Java, really doesn't matter): there is a queue of int wrapper objects (Integer class) in which no two objects have the same int value stored. The queue is passed to a method and the question asks to sort the entire queue using no helper variables whatsoever. Keeping in mind that a for loop requires a counter variable in order to iterate.
For proof that I am not looking for an answer to this assignment and for clarity of the question, you can find it here (it's Question #2).
The QueueInterface interface contains the following method definitions:
public void createQueue ();
public boolean isEmpty ();
public void dequeueAll ();
public void enqueue (Object newItem);
public Object dequeue ();
public Object peek ();
I am looking for a solution to the +2 bonus, using no helper variables whatsoever. I was able to sort the queue using only one of the two helper stacks for a +1 though.
Thanks.