NAME:

LOGIN:

PRECEPT:

COS 226 Exercises on Stacks and Queues


1. Describe how to implement a queue using two stacks. Starting from an initially empty queue, any sequence N of enqueue and dequeue operations should take time proportional to N.