The Algorithm Codex
Most algorithm books fall into one of two traps: they are either dense academic tomes filled with dry proofs, or shallow "cookbooks" that offer recipes without understanding. The Algorithm Codex is designed to be the middle path.
This is a living repository of common and advanced algorithms, written for students, researchers, and developers who want to understand the why before the how.
The Philosophy: Code as Prose
This project is built on the principle of literate programming. The source code you see in the book isn't just a snippet; it is the actual source used to build the library. There is no pseudo-code here—only actual, runnable Python 3.13 that leverages modern features like PEP 695 generics and strict type protocols to ensure clarity and correctness.
Current Status: The Foundation is Ready
The Codex is a massive undertaking, and we have just finished the first major milestone. By downloading this version, you gain access to:
- Part I: Searching and Sorting – A deep dive into the "geometry of inversions," from the simplicity of linear search to the elegance of Quick Sort and the domain-specific power of Radix Sort.
- Foundations – A primer on "back-of-the-envelope" cost analysis and the scaling intuition of Big O notation.
- The Python & Asymptotic Primers – Short appendices covering modern Python syntax and the formal math behind algorithmic growth.
NOTE: This is a work-in-progress. There may be mistakes in the prose or code (although we have comprehensive unit tests) and large part of the content is missing or incomplete. By getting the PDF now you'll receive all future copies via email notification for no additional cost.
The Grand Plan: 8 Volumes of Computation
This is just the beginning. The grand roadmap for the Codex includes eight comprehensive parts:
- Searching and Sorting (Complete)
- Fundamental Data Structures (In Progress)
- Trees
- String Algorithms
- Graphs
- Dynamic Programming & Greedy Algorithms
- Specialized Domains (Geometry, Number Theory, Game Theory)
- Advanced Complexity (NP-Completeness and Approximation)
Why is this $5+?
I believe that foundational knowledge should be accessible to everyone. You can read the entire book for free online at matcom.github.io/codex.
This Gumroad listing is for those who want to:
- Own a high-quality PDF for offline study.
- Support the author as I continue to write the remaining seven parts of the Codex.
- Invest in independent, open-source education.
Pay what you consider. If you find value in these pages, your support helps keep the project alive and the updates coming.
Current and all future digital copies (PDF)