Pregunta de entrevista de acadnion

how to implement a queue given two stacks

Respuesta de la entrevista

Anónimo

18 may 2017

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