Statewalk

Watch the state until it makes sense.

Interactive essays for understanding systems.

Heap · 1/4

Cover

Building a heap, from the bottom up

A min-heap is built by repairing a sequence of local promises, starting at the last parent.

Read the essay

Also

02Red and blue on a closed interval

Binary search is not about finding a value. It is about locating the partition point where a predicate turns from false to true.

Read

03Keeping a join alive, one row at a time

Four relations in a chain. A row is live when it can reach the bottom of the chain, and only the top of the chain ever emits a number.

Read

04Monotonic stacks: let the future resolve the past

A next-greater element is not a search for every position. It is a queue of unresolved promises, settled once by the first larger value.

Read