Tag Archives: interview question

Queue Implemented Using Stacks

Here are two solutions for using stacks to emulate a queue. The first always keeps one or both stacks empty, shifts the set of values back and forth as the caller switches between enqueuing and dequeueing. The second maintains an … Continue reading

Posted in Algorithms, C++ | Tagged | Leave a comment