Frage im Vorstellungsgespräch bei MathWorks

Explain how do you implement queue using stack?

Antwort im Vorstellungsgespräch

Anonym

19. Jän. 2015

In InsertQueue(element X) operation (Using 2 queues Stack1 and Stack2) 1.Push all elements from stack1 to stack2 2.Place X onto stack 1. 3.Remove all the elements and place them back onto stack 1 DeleteQueue() 1.return element at top of stack1.