Ordering contracts for undo, buffering, and scheduling. Work through the operation contract, runnable case, and cost before selecting the structure for a real workload.
Lessons
- Stacks: last-in-first-out for reversible edits
- Queues: preserve arrival order without front shifts
- Ring buffers: make capacity and overwrite rules explicit
Practice and next steps
- Project: choose structures for a dispatch board
- Project: audit depot connectivity and daily ranges
- Linear and hash structure decisions
- Tree, graph, and range structure decisions
- DSA Tutorial
Monotonic deques: maintain a sliding minimum in linear time
Bounded thread queues: separate FIFO removal from task completion
Bounded queues: close, wake waiters, and drain accepted work
CAS queue protocol: link, help, and reclaim safely
Hashed timing wheels: bucket incident expiries by tick
Two-stack window aggregation: keep FIFO order under a monoid
