Advanced Algorithms & Data Structures
For when the interview basics aren’t enough.
The specialized machinery behind real systems — range-query trees, string automata, network flow, and probabilistic sketches — each played as an interactive visualization, in a coherent order.
- Reach for the right advanced structure: segment / Fenwick trees, B-trees, skip lists
- Match many patterns and query trees in linear or logarithmic time
- Model problems as max-flow and estimate at scale with probabilistic sketches
The Segment Tree
Range queries and updates in O(log n).
Bits Do the Walking: Fenwick Tree
The leaner prefix-sum tree — same power, less code.
How Databases Stay Balanced: B-Trees
How database indexes stay balanced and shallow on disk.
Express Lanes: The Skip List
Balance by coin flips instead of rotations.
Two Nodes, Climbing to Meet: LCA with Binary Lifting
Jump up a tree in powers of two.
The Non-Backtracker: KMP
Single-pattern matching with no backtracking.
One Pass, Every Word: Aho-Corasick
A whole dictionary matched in one pass.
Cycles Into Components: Tarjan’s SCC
Strongly connected components in one DFS.
Pushing Water Through Pipes: Dinic’s Max-Flow
Max-flow / min-cut, the fast way.
Fibonacci Fast-Forwarded: Matrix Exponentiation
Linear recurrences in O(log n).
Halving the Exponential: Meet in the Middle
Halve the exponent on brute force.
Counting a Crowd in Kilobytes: HyperLogLog
Count billions of distinct items in kilobytes.
The Fair Draw: Reservoir Sampling
Sample a stream of unknown length in one pass.