Queues model FIFO flows. Interviews use them for BFS traversals, rate limiting, and buffering problems.
- Implementations: array-based circular buffers vs linked-list-backed queues.
- Variants: double-ended queues, monotonic queues, and priority queues for scheduler questions.
- BFS scaffolding: level-order traversals in trees/graphs and multi-source propagation.
- Concurrency considerations: producer-consumer coordination and blocking queues.
- Task schedulers: print queues, job dispatchers, and message brokers.
- Rate limiting: API request throttling and sliding-window counters.
- UI interactions: undo/redo pipelines, command buffers, and event loops.
queue.go: idiomatic Go queue implementation with enqueue/dequeue helpers.queue_test.go: unit tests covering underflow, overflow, and mixed operation sequences.
- Extend the queue to a double-ended version and mirror the tests.
- Implement a bounded blocking queue using channels to simulate concurrency constraints.
- Use the queue in
tree/BFS functions to reinforce cross-folder practice. - Solve classic problems like "rotting oranges" or "minimum steps to reach end" using this queue.
- Explore monotonic queues for sliding window maxima/minima problems.
- Build a rate limiter middleware that uses fixed-window or token-bucket logic.
- Combine with
heap/to simulate priority scheduling in operating systems.