title | date | draft | tags | categories | |||
---|---|---|---|---|---|---|---|
Algorithm4 Java Solution 1.3.06 |
2019-07-04 05:47:10 +0800 |
false |
|
|
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.