| title | Algorithm4 Java Solution 1.3.06 | ||
|---|---|---|---|
| date | 2019-07-04 05:47:10 +0800 | ||
| draft | false | ||
| tags |
|
||
| categories |
|
What does the following code fragment do to the queue q?
Stack<String> stack = new Stack<String>();
while(!q.isEmpty())
stack.push(q.dequeue());
while(!stack.isEmpty())
q.enqueue(stack.pop());reverse the elements order in q.