Implement a Queue using a stack.
No restriction on space complexity.

One possible Solutions
a costly procedure...
1. Use a temp stack
2. Insertion into queue
- Push the element into the original stack
3. Deletion from queue
- Pop all the elements from stack into a temp stack
- pop out the first element from the temp stack
- pop all the remaining elements back to the original stack


What is a queue?
QUOTE
A queue is a particular kind of collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position and removal of entities from the front terminal position. This makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that whenever an element is added, all elements that were added before have to be removed before the new element can be invoked. A queue is an example of a linear data structure.


for more... Follow the below link.

http://en.wikipedia.org/wiki/Queue_%28data_structure%29

 

 

 


Reply