Algorithm Catalog
Pick anything to open it in the studio. Press ⌘K to jump straight to an algorithm by name.
Sorting Algorithms
Watch comparison and distribution sorts order a field of glowing 3D bars, step by step.- Bubble Sortintro
Adjacent swaps bubble the largest element to the end each pass.
O(n²) avg · O(1) space
- Insertion Sortintro
Grows a sorted prefix, sliding each new value back into place.
O(n²) avg · O(1) space
- Selection Sortintro
Repeatedly finds the minimum and swaps it into position.
O(n²) avg · O(1) space
- Shell Sortcore
Insertion sort over shrinking gaps, so values travel further per move.
O(n^1.25) avg · O(1) space
- Comb Sortcore
Bubble sort with a shrinking gap that kills small values stranded at the end.
O(n² / 2^p) avg · O(1) space
- Cocktail Shakercore
Bubble sort that alternates direction on every pass.
O(n²) avg · O(1) space
- Merge Sortcore
Divide, sort each half, then merge — guaranteed O(n log n).
O(n log n) avg · O(n) space
- Quick Sortcore
Partition around a pivot, then recurse on both sides.
O(n log n) avg · O(log n) space
- Heap Sortadvanced
Build a max-heap, then repeatedly extract the root.
O(n log n) avg · O(1) space
- Radix Sort (LSD)advanced
Sorts by digit position — no comparisons at all.
O(d·(n+k)) avg · O(n+k) space
- Gnome Sortintro
Steps forward when ordered, back when not — insertion sort with one loop.
O(n²) avg · O(1) space
- Odd-Even Sortcore
Alternates comparing odd and even index pairs — trivially parallelisable.
O(n²) avg · O(1) space
- Pancake Sortadvanced
Only operation allowed is reversing a prefix — flip the biggest to the top, then to the end.
O(n²) avg · O(1) space
Searching Algorithms
Hunt for a target value across a sorted field, with live search windows and probes.- Linear Searchintro
Check every element in order until the target turns up.
O(n) avg · O(1) space
- Binary Searchintro
Halve the search window with every comparison.
O(log n) avg · O(1) space
- Jump Searchcore
Skip ahead in √n blocks, then walk back linearly.
O(√n) avg · O(1) space
- Exponential Searchcore
Double the bound until it overshoots, then binary-search inside it.
O(log n) avg · O(1) space
- Interpolation Searchadvanced
Guesses where the target should be, given a uniform distribution.
O(log log n) avg · O(1) space
- Ternary Searchcore
Splits the window into thirds instead of halves.
O(log₃ n) avg · O(1) space
Graph Algorithms
Traverse, connect and find shortest paths over a 3D node-link network as frontiers expand.- Breadth-First Searchintro
Expands in rings from the start — shortest path by edge count.
O(V+E) avg · O(V) space
- Depth-First Searchintro
Follows one branch as deep as it goes before backing up.
O(V+E) avg · O(V) space
- Dijkstra'score
Always settle the nearest unvisited node; relax its edges.
O(E log V) avg · O(V) space
- A* Searchadvanced
Dijkstra plus a heuristic that aims the search at the goal.
O(E log V) avg · O(V) space
- Bellman–Fordcore
Slower than Dijkstra, but correct with negative edges.
O(VE) avg · O(V) space
- Kruskal's MSTcore
Cheapest edge first, skipping anything that closes a cycle.
O(E log E) avg · O(V) space
- Prim's MSTcore
Grows one tree outward — same optimum as Kruskal, different picture.
O(E log V) avg · O(V) space
- Topological Sortcore
Dependency order — the algorithm behind every build system.
O(V+E) avg · O(V) space
- Union–Findcore
Union by rank and path compression, drawn as a live forest.
O(α(n)) avg · O(V) space
- Tarjan SCCadvanced
Low-links and one DFS pass find every strongly connected component.
O(V+E) avg · O(V) space
- Max Flowadvanced
Saturate the shortest augmenting path, and let residuals undo mistakes.
O(VE²) avg · O(V²) space
Tree Algorithms
Build, search and traverse a binary search tree laid out in space.- BST Insertionintro
Descend left or right by comparison, then hang the new node off a leaf.
O(log n) avg · O(n) space
- BST Searchintro
One comparison per level discards half the remaining tree.
O(log n) avg · O(1) space
- In-order Traversalintro
Left, node, right — visits a BST in sorted order.
O(n) avg · O(h) space
- Pre-order Traversalintro
Node first, then subtrees — the shape you need to rebuild a tree.
O(n) avg · O(h) space
- Post-order Traversalintro
Subtrees first, node last — the order you free or evaluate in.
O(n) avg · O(h) space
Data Structures
See lists, heaps, hash tables, tries and balanced trees reshape themselves under each operation.- Linked Listintro
Pointers made visible — O(1) to relink, O(n) to get there.
O(n) avg · O(n) space
- Stack vs Queueintro
One script, two containers — LIFO reverses, FIFO preserves.
O(1) avg · O(n) space
- Hash Table (Chaining)core
Collisions hang off the bucket — cost follows load factor.
O(1 + α) avg · O(n) space
- Hash Table (Open Addressing)core
Everything in one array — fast, until the clusters start growing.
O(1/(1-α)) avg · O(n) space
- Min-Heapcore
Only local comparisons, yet the minimum is always on top.
O(log n) avg · O(n) space
- Triecore
Shared prefixes are shared paths — the shape is the data.
O(m) avg · O(ALPHABET · N · m) space
- AVL Treeadvanced
Rotations that stop a BST degenerating into a linked list.
O(log n) avg · O(n) space
- Segment Treeadvanced
Range sums in log time, and still correct after an update.
O(log n) avg · O(n) space