how to implement a queue given two stacks
Anonymous
Let queue to be implemented be q and stacks used to implement q be stack1 and stack2. This method makes sure that newly entered element is always at the top of stack 1, so that deQueue operation just pops from stack1
Check out your Company Bowl for anonymous work chats.