Q:

Using Queues for a Stack and Stacks for a Queue

I was asked a question on how to use a pair of Queues to create a Stack and how to use a pair of Stacks to create a Queue.  Any thoughts on how I would do this?  Right now I don't even know where to start. 

A:

To answer the question in the comment above-
Two queues to implement a stack(Assume Queue A is filled with elements in LIFO order and Queue B is empty):
PUSH: Empty Queue A into Queue B. LIFO order will be persisted in Queue B. Now insert the new element into Queue A. Now empty Queue B into Queue A.
POP: Dequeue from Queue A

