Foundations
Big-O, Omega and Theta notation kept properly distinct from best, average and worst case analysis — plus amortized analysis and where asymptotics stop predicting real performance.

Mastering Algorithms is a free, structured guide to the algorithms and data structures that actually come up — in coursework, in technical interviews, and in production code. It covers 36 topics across nine areas, each with a plain-language explanation, a complexity analysis, a worked example traced step by step, and Python you can run.
What distinguishes it is the verification. Every code listing on this site is executed before it is
published. Sorting algorithms are tested against Python's own sorted() across thousands
of randomised inputs; pattern-matching algorithms are checked against brute force; the neural
network's backpropagation is validated against numerically estimated gradients. Every worked example
is traced from the algorithm printed on the same page, so the numbers in the walkthrough are the
numbers the code actually produces.
That sounds like a low bar. It is not one most algorithm tutorials clear — and when a trace is wrong or an implementation does not match its stated complexity, the reader who is trying hardest to follow along is the one who gets stuck. In August 2026 the entire site was re-audited line by line and 58 corrections were applied. You can read more about that process on the about page.
Big-O, Omega and Theta notation kept properly distinct from best, average and worst case analysis — plus amortized analysis and where asymptotics stop predicting real performance.
Eight algorithms from bubble sort to a complete Timsort with run detection, galloping and the merge-stack invariants — plus what standard libraries actually run, which is none of the eight.
Linear and binary search with the off-by-one traps spelled out, plus hash tables — the structure most real lookup code actually uses.
Traversal, shortest paths and connectivity: DFS and BFS through to Dijkstra's, Bellman-Ford, Floyd-Warshall, A*, topological sort and strongly connected components.
Traversals, binary search trees, and the balancing machinery underneath them — rotations, AVL, red-black, and the B+ trees that every database index is built on.
Memoization versus tabulation, the standard DP patterns, and the matroid theory that actually answers when a greedy algorithm is guaranteed to be optimal.
KMP with its failure function derived, Rabin-Karp rolling hashes, Boyer-Moore, the Z-algorithm, and Manacher's for palindromes in linear time.
AES, RSA, SHA and their broken predecessors — with current guidance, including why TLS 1.3 dropped RSA key exchange and what the 2024 post-quantum standards change.
From linear regression to gradient boosting and transformers, with an honest treatment of evaluation — including calibration, which most introductions skip entirely.
The chapters are ordered so each builds on the last, but nothing stops you jumping straight to what you need.
Free to read in full. No account, no paywall, no signup.