This is not a HW or assignment. This is something i'm practicing myself.
Given a queue, write a Reverse method reverses elements of a queue. MyQueue remains unchanged.
Signature:
public Queue<T> reverse(Queue<T> myQueue) {
Note: It is unknown if the Queue is made using nodes or array.
The queue has methods already implemented, that we can use:
void enqueue(T element)
T dequeue();
boolean isFull();
boolean isEmpty();
int size();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…