I · The linear primitives

Deque

Both ends, equally.

The story

A queue that allows insert and delete at both ends: a "double-ended queue". Knuth catalogued it as the unifying abstraction over stacks and queues. C++ std::deque made it ubiquitous; Python collections.deque is the same idea in a single line.

How it works

Most efficient implementation is a sequence of fixed-size blocks linked in a list, with separate front and back pointers. Random access is O(1); both-end ops are O(1) amortised.

Where it lives

C++ STL deque. Sliding-window algorithms. Browser history. Work-stealing schedulers (each worker has a deque; thieves steal from the back, owner from the front).

The key insight

The work-stealing deque is the magic behind Java's ForkJoinPool, Go's scheduler, Rust's Rayon, .NET's TPL. One data structure, one paper, every modern parallel runtime.