120 chapters live

Algorithms, taught the right way.

The open-source data-structures and algorithms handbook. 120 chapters, 37 pattern decision pages, 338K+ words. Solutions in Python, Java, C++ and Go — read on the web or GitHub, no sign-up required.

120chapters
37patterns
4languages
CC BY-SAopen content
120chapters live
Part 12 · Strings & Pattern MatchingTrie

Trie.

Walking down letters until the word completes itself.

n 1960, Edward Fredkin coined the name trie from retrieval, and asked us to pronounce it like tree to match. Nobody listens. We say try, to keep it apart from the binary tree it isn’t. The shape, though, is exactly what you’d reach for if asked to look up a word in a dictionary in time that depends on the word, not the dictionary: one node per prefix, one edge per letter. Every search box you’ve touched today walks one of these.

249
NOW READING Ch. 12.4 — Trie
5 / 6
The gap

Every other DSA repo has a problem.

You've starred five awesome-lists. You've bought a Premium subscription. You still don't have a coherent place to learn DSA. Here is why.

Problem dumps

NeetCode 75, Blind 75, Top 150 — lists of problems with no story binding them together. You grind, you forget, you grind again.

Pattern names without rules

"Use sliding window when…" trails off into hand-waving. Nobody tells you when fixed-window beats variable-window, or when to abandon the pattern entirely.

One language only

The site teaches in Python; your interview is in Java. The translation is on you, and the idioms don't carry over cleanly.

Solutions without intuition

Editorials explain the code that works. They rarely explain the dead ends, the trade-offs, or the recurrence you would have written first.

Locked behind a paywall

The good explanations live behind LeetCode Premium, paid courses, or someone's $40 PDF. The free tier teases substance and redirects.

How this is different

A handbook, not a problem list.

Every chapter is a complete teaching article with intuition, derivations, multi-language solutions, and a routing rule that tells you when to reach for the technique. Ordered, opinionated, openly licensed.

The curriculum

15 parts, 120 chapters, 1128 pages.

Sequenced by dependency, not topic alphabet. Every chapter declares its prerequisites; you always know what to read next. Comparable in scope to Introduction to Algorithms — openly licensed.

PART 0 / 157 chapters

Foundations

The do-not-skip prerequisites. Big-O, recursion, bit ops, math for interviews, language idioms. Most readers want to skip Part 0 and shouldn't.

PART 1 / 158 chapters

Linear Data Structures

Arrays, dynamic arrays, strings, hash maps, hash collisions, stacks, queues, deques, matrix manipulation. The vocabulary every interview problem assumes you have.

PART 2 / 158 chapters

Search and Sort

Linear search, binary search variants, comparison sorts, heap sort, linear sorts, quickselect. The first place algorithmic thinking shows up.

PART 3 / 156 chapters

Pointers, Window, Prefix

Two-pointer techniques, fixed and variable sliding windows, prefix sums, and prefix-sum-plus-hash. The highest interview-ROI part of the curriculum.

PART 4 / 155 chapters

Stack and Queue Patterns

Monotonic stacks, parentheses matching, BFS-on-deque, sliding-window maximum. Stack and queue as algorithmic primitives, not data structures.

PART 5 / 156 chapters

Linked Lists

Pointer rewiring, cycle detection, k-way merge, LRU cache. Bridges to Part 13's design problems.

PART 6 / 1511 chapters

Trees and Heaps

Tree traversals, BSTs, balanced trees, heaps, priority queues, tries. The most-asked topic class in mid-level interviews.

PART 7 / 157 chapters

Recursion and Backtracking

Recursion mental model, backtracking templates, divide-and-conquer, permutations, combinations, subset generation. Pre-DP.

PART 8 / 1513 chapters

Graphs

BFS, DFS, topological sort, shortest paths, MSTs, graph colouring, union-find. The largest topic-coverage part; bridges to Part 9.

PART 9 / 1515 chapters

Dynamic Programming

Memoization, tabulation, classic DP patterns (LIS, LCS, edit distance, knapsack), DP on trees and graphs, bitmask DP. The hardest topic class.

PART 10 / 155 chapters

Greedy

Greedy proofs, exchange arguments, interval scheduling, Huffman coding.

PART 11 / 154 chapters

Bit Manipulation

Bit tricks, XOR techniques, bitmask enumeration, single-number patterns.

PART 12 / 156 chapters

Strings and Pattern Matching

Naive matching, KMP, Rabin-Karp, Z-algorithm, suffix arrays. Strings as first-class objects, not character arrays.

PART 13 / 157 chapters

Design the Data Structure

Design problems: LRU, LFU, autocomplete, rate limiter, time-series store. Composing data structures into interview-grade systems.

PART 14 / 1512 chapters

Interview Framework

The interview framework: clarifying questions, brute-force-then-optimise, complexity articulation, edge cases, code walk-through, and company-specific flavours.

See the full curriculum

The rules we hold ourselves to

The principles.

These are not aspirational. They are enforced in code review and CI.

One hundred percent inline content

Every chapter is a full teaching article. No "watch this video for the explanation." If a concept matters, it is explained here, with figures, derivations, and worked examples.

Patterns before problems

Each technique gets a decision page that tells you when to reach for it. Routing rule, discriminator, signature problem. Then you grind.

Code in four languages

Every canonical solution ships in Python, Java, C++ and Go. Idioms translated, not transliterated. Pick yours and switch back when you want a second view of the same idea.

Honest about complexity

We don't use the words "simply" or "just." DP is hard. Hard problems get the page space they need; we walk through the recurrence on paper before showing the memoised version.

Modern and maintained

Every chapter has a date_updated. Out-of-date complexity claims and stale interview tropes get flagged in review. The handbook moves with the field.

Open-licensed, readable without a sign-up

CC BY-SA 4.0 for content, MIT for code. The ShareAlike clause keeps the chapter text itself open to read and remix — nobody can lock it behind a paywall. No tracking, no email gate, no ads.

The end of the intro

Ready to solve?

Start from the foundations or jump straight to the highest-ROI patterns. The chapters are open to read — no sign-up, no paywall — so you can go as deep as you like.