Stack using Queues

Implement LIFO behavior using two FIFO Queues.

Q1 (Main)
Empty
Q2 (Auxiliary)
Empty
Status: Ready
Speed

Algorithm Logic

1function push(x):
2 q2.enqueue(x)
3 while !q1.empty():
4 q2.enqueue(q1.dequeue())
5 swap(q1, q2)