Each topic has three parts: a short brief, a step-by-step walkthrough, and practice on random inputs where you make the algorithm's decisions yourself. The tracks below are in a suggested order, but each topic stands on its own.
Keeping keys in order so a lookup can rule out half of them at a time, and keeping it that way as keys come and go.
Halve a sorted array with every comparison: lo, hi, mid, and the off-by-one traps.
Search, insert and delete, including the in-order successor, and why the height matters.
Builds on: binary search
Heights, balance factors, and the four single and double rotations that keep every node within one level.
Builds on: binary search trees
Remove as in a BST, then walk up: why balance 0 now means "keep going", and why one delete can need several rotations.
Builds on: AVL trees
Recoloring, rotations and the five fix-up cases that keep a binary search tree balanced.
Builds on: binary search trees, rotations
When a black node disappears: the "double black" and the five cases that push it up or away.
Builds on: red-black trees
Many keys per node and splits that grow the tree from the top: how databases keep lookups to a few disk reads.
Builds on: binary search trees
An underfull node borrows from a sibling through the parent, or merges with it, and the tree shrinks from the top.
Builds on: B-trees
Looking keys up without searching: compute where they belong.
From the simplest sort, through priority queues and three O(n log n) sorts, to beating n log n when keys are digits.
The simplest sort: slide each value into a growing sorted part. Fast on nearly sorted input, O(n²) otherwise.
A complete tree stored in an array: sift-up, sift-down, and why you swap with the larger child.
Bottom-up build-heap in O(n), then repeatedly swap the max to the end: O(n log n), in place.
Builds on: binary heaps
Lomuto partitioning step by step, where the pivot lands, and why sorted input is the worst case.
Split in half, sort each half, merge: two pointers, a buffer, and a guaranteed O(n log n).
Sorting without comparisons: counts, prefix sums, stable placement, and one digit per pass.
Builds on: merge sort (stability)
Exploring networks of nodes and edges, and finding shortest routes through them.
A queue explores ring by ring, a stack goes deep and backs up. Same graph, different order.
Order tasks so every prerequisite comes first, with Kahn's algorithm, and spot cycles that make it impossible.
Builds on: graph search
Shortest paths with edge lengths: settle the closest node, relax its edges, repeat.
Builds on: BFS, priority queues (binary heaps)
Shortest paths when edges can be negative: relax every edge, pass after pass, and catch negative cycles.
Builds on: Dijkstra
Shortest paths between every pair at once: a table, and one more allowed stop per round.
Builds on: Dijkstra, dynamic programming
Disjoint sets as trees of parent pointers: find, union by rank, and path compression.
Kruskal's algorithm: take the lightest edge that doesn't close a cycle, checked with union-find.
Builds on: graph search, union-find
The other way to a minimum spanning tree: grow one tree by its lightest outgoing edge. Dijkstra's twin with a different update rule.
Builds on: minimum spanning trees, Dijkstra
Storing words so their shared beginnings are shared, and finding a pattern without backing up.
Solving each overlapping sub-problem once, in a table.
How topics are built: CONSTITUTION.md.