Frage im Vorstellungsgespräch bei Microsoft

How do you simulate the functionality of a queue using 2 stacks

Antwort im Vorstellungsgespräch

Anonym

10. Dez. 2014

Not the most effective way but. Once the stack is full keep popping elements of stack 1 into stack 2 until stack 2 is full. Then start popping element by element to simulate a fifo.