| Quick Reference Queue CheatsheetA queue on one page — enqueue and dequeue, and the traps around the rear, circular full checks, and BFS visits. 10 sections 10 tables 14 code snippets First in, first outEnqueue at the right Dequeue from the left The rule
This page is a queue. A linked list is left out. OperationsPeek leaves the front in place Cost at the right ends
Circular arrayOne cell stays unused Wrap the indexes
Front and rearClear both ends Two pointers
deque and QueueThe slow front A full deque drops items Which object
Breadth-first searchMark early One level Why the queue
Priority is not FIFOSmallest, not oldest A different order
Sliding-window maximumDrop smaller backs Indexes, largest at the front
Where queues show upThe person at the front leaves The same FIFO idea
Interview trapsBoth calls on the right end Nothing at the front Traps worth memorising
How to use this page: enqueue with |