Algorithms & data structures
The parts in four themes. Every card shows a small live version of its page; open one to run it with your own input.
Sorting & searching
Sorting
Ten algorithms as bars, step by step, with exact counts of comparisons and writes.
Open →Sorting race
Two algorithms, the same numbers. The clock counts work, so the finishing order is exact.
Open →Big-O chart
How the work grows from 5 to 100 numbers, next to n log n and n².
Open →Binary search
Linear and binary search side by side on the same sorted list: 200 numbers, at most 8 looks.
Open →Data structures
Stack
Push, pop and peek: last in, first out.
Open →Binary search tree
Insert, search and remove, and watch the tree take shape.
Open →AVL trees & traversals
Sorted numbers make a plain tree a chain; an AVL tree rotates and stays low. Plus in-, pre-, post- and level-order.
Open →Queue, list & LRU
A queue, a linked list you walk node by node, and a cache that forgets the least recently used.
Open →Hash table
From key to hash to bucket: collisions, chaining, probing and resizing.
Open →Strings, bits & compression
Edit distance
How many changes turn one word into another? A table filled cell by cell.
Open →Optimal search tree
The words searched most often go near the top: a table filled range by range finds the cheapest tree.
Open →Huffman coding
Short codes for common characters: the idea inside zip, PNG and JPEG.
Open →Bloom filter
A few bits that answer "maybe" or "certainly not", and sometimes a false positive.
Open →SHA-256
Change one bit of the text and half the bits of the hash change: the avalanche effect, round by round.
Open →Disk defragmentation
Files in pieces all over a disk, gathered up again one cluster at a time, like in the 90s.
Open →Bytes
Text as UTF-8 and numbers in any width, two's complement and byte order.
Open →Graphs & simulation
Pathfinding
Draw walls and mud and compare BFS, DFS, Dijkstra and A* on the same grid.
Open →Minimum spanning tree
Kruskal joins every node with the lightest edges, skipping any that would make a loop.
Open →Game of Life
Cells that live or die by counting neighbours. Gliders, guns and other rules.
Open →