Queue
You join at the back and leave from the front, like a queue at a counter.
Queue: Enqueue, dequeue, peek
An empty queue. Things join at the REAR and leave from the FRONT.
Cost
- Enqueue
- O(1)
- Dequeue
- O(1)
- Peek
- O(1)
- Search
- O(n)
- Space
- O(n)
Before this
Leads to
Topics that need this one first.
Taught by the same lesson
Queue covers these too, in the same run.