Data structures & algorithms
Once by the book.
Once where it earns its place.
The fundamentals in their textbook form and inside a real system. Explore how a structure works, what your language already ships, and the situations where one choice earns its place over another.
Moving in. 30 of 30 topics have lessons; they're moving over from the old site.
Moving in 30 of 30 topics have lessons, which are moving over from the old site. Planned topics show where the catalog is going.
Foundations and cost
Name the input, count the work, and keep memory honest.
Time and space complexity
Count repeated work and growing storage over turbine inspection cards before a small input hides the difference
TypeScriptGoRecursion
Solve a nested recipe from its base case upward, then choose between the call stack and explicit frames
TypeScriptGoDynamic programming
Reuse overlapping postage subproblems with a memo or a bottom-up table, then compare the state-space cost
TypeScriptGoSequences and ordered work
One after another, and what it costs to reach the middle.
Stack
Resume nested compost-hub procedures by restoring the newest saved cursor first
TypeScriptGoRustQueue and deque
Keep ballot batches in order and restore one interrupted batch at the front of a growable ring
TypeScriptGoRustRing buffer
Keep a lift station’s latest signed level offsets in fixed slots, and choose overwrite or refusal when full
TypeScriptGoRustLookup, membership, and eviction
Find a value, remember what you have seen, and decide what to keep.
Hash map
Find a film reel by normalized canister label: hash to a bucket, compare keys, and preserve lookup through growth
TypeScriptGoRustHash set
Keep a birder’s life list once each: hash a species code, probe past collisions, and leave a tombstone when you remove one
TypeScriptGoOrdered map
Edit a podcast’s chapter markers: find the chapter at the playhead, jump to the next, keep markers 10 seconds apart, and list what is in view
TypeScriptGoLRU cache
Resolve a café’s short links from memory: a hash map finds each link, a linked list keeps recency, the least recently used is evicted, and a changed link is invalidated
TypeScriptGoTrees, priority, and prefixes
Keep enough order to answer a useful question quickly.
Binary heap
Keep the highest-priority item within reach without sorting everything
TypeScriptGoRustTrie
Suggest emoji as someone types a shortcode: share prefixes, complete by popularity, prune removed codes, and weigh the cost of the nodes
TypeScriptGoBinary search tree
Find a conference badge by name: branch left or right, watch a sorted export build one long branch, and rotate to keep lookups short
TypeScriptGoB+ trees and indexes
Index a bakery’s orders by day: keep sorted records in linked leaf pages, split a full page and grow a new root, and read a range of days down one path and along the leaves
TypeScriptGoGraphs and connectivity
Things that point to one another, and the ways to follow those connections.
Adjacency list
Map an island airline’s nonstop routes: keep each airport’s departures and arrivals as lists, check a route, close an airport, and compare with a matrix
TypeScriptGoUnion-find
Group duplicate photos from matching pairs: merge groups, check whether two photos belong together, and rebuild when a photo is taken out
TypeScriptGoBreadth-first and depth-first search
Search a project folder: find the nearest package.json one layer at a time, add up folder sizes branch by branch, and survive a symlink loop
TypeScriptGoTopological sort
Calculate an invoice sheet: order cells so each formula runs after what it reads, recalculate only what an edit reaches, and catch a circular reference
TypeScriptGoGraph overview
Model a bicycle-repair cooperative’s shared parts ledger: members as nodes, debts as directed weighted edges, and balances, groups, cycles, and settlement as graph questions
TypeScriptGoApproximate structures
Smaller memory footprints, with the uncertainty made explicit.
Bloom filter
Screen sign-up passwords against a common-password list: hash to a few bits, trust a no, and ask the full list only on a maybe
TypeScriptGoCount-min sketch
Spot a neighborhood forum’s trending hashtags: count into a small table of counters, never undercount, and rotate each hour
TypeScriptGoHyperLogLog
Count a transit line’s different riders from card taps: keep the longest run of zeros per bucket, merge stations and days, and trade 1.6% error for kilobytes
TypeScriptGoSearch, sorting, and sequence techniques
Ways to work over a sequence, and what makes each approach useful.
Binary search
Read a day of tide predictions: halve the range on every probe, find insertion positions, and keep the boundary conditions honest
TypeScriptGoSorting
Shelve a library’s returned books: insertion-sort small piles, merge them stably, and see why the built-in sorts work the same way
TypeScriptGoSliding window
Excerpt a product review: grow a window on the right, shrink it on the left, and keep a running summary instead of rereading
TypeScriptGoTwo pointers and prefix sums
Find two sorted book prices that use up a gift card exactly, and answer repeated contiguous totals with stored prefix boundaries
TypeScriptGoDivide and conquer, greedy choices, and backtracking
Choose a strategy by its proof: combine backlog runs, book conservation appointments by earliest finish, and restore choices until spare workshop minutes fit exactly
TypeScriptGoMonotonic stacks, interval problems, and string matching
Keep unresolved readings ordered, merge overlapping maintenance windows after sorting, and reuse pattern borders when searching logs
TypeScriptGo