Queue
TimeO(1) per opSpaceO(n)
A queue is first-in, first-out. New items join at the rear; we always remove from the front — the opposite of a stack.
Key idea. First-in, first-out. Enqueue at the rear, dequeue from the front — the engine behind breadth-first search.
1
Loading…
—