Loading...
Implement a FIFO queue using only two stacks. Support push, pop (remove front), peek (get front), and empty.
Output the result of pop, peek, and empty operations.
push,1;push,2;peek;pop;empty
1 1 False
push,1 and push,2 add elements 1 and 2 to the queue.peek operation returns the front element of the queue, which is 1, since the queue is implemented as a FIFO data structure.pop operation removes the front element from the queue, which is also 1, and returns it.empty operation checks if the queue is empty after the pop operation; since there is still one element (2) left in the queue, it returns False.