The Algorithms – Python is the largest open-source catalog of algorithms implemented in Python: every classic algorithm from sorting and searching to graph traversal, machine-learning basics, cryptography, and computational geometry, each with a working Python implementation you can read and run. Reference material and study aid in one.
View The Algorithms – Python on GitHub

- 223,144 stars
- 50,902 forks
- Python
- MIT License
The Algorithms – Python: Executable, Not Pseudocode
The repository’s whole value is that every algorithm has working Python code you can clone, run, and modify. Pseudocode in textbooks is unambiguous in theory but ambiguous in practice: variables get renamed, edge cases get glossed, the actual loop structure gets fuzzy. Here, you can python -m algorithms.sorts.quick_sort and get an answer. The implementation is the spec.
This makes it the right reference when you’re learning an algorithm and want to see what it actually looks like in code, or when you’re reviewing for an interview and want to verify your mental model against a working version.
What’s in the box
Broad coverage: Sorts (bubble, insertion, selection, merge, quick, heap, radix, bucket, cocktail, comb, etc.), Searches (binary, interpolation, jump, fibonacci, tabu), Graphs (BFS, DFS, Dijkstra, A*, Bellman-Ford, Floyd-Warshall, Kahn, Kruskal, Prim, minimum spanning tree), Dynamic Programming (knapsack variants, longest common subsequence, coin change, matrix chain), Strings (Rabin-Karp, KMP, Boyer-Moore, Aho-Corasick, Manacher), Math (prime sieves, modular arithmetic, matrix ops, FFT), Ciphers (Caesar, Vigenère, RSA, AES helpers), Machine Learning (k-means, k-NN, decision tree, gradient descent, neural network baselines), Computer Vision bases, Genetic Algorithms, Neural Networks, Data Structures (every tree, heap, list variant), and more.
The depth varies (sorts and graphs are exhaustive, ML is introductory), but the floor is “a real implementation that runs.”
Contributing is the pedagogy
The repository is one of the most-contributed-to on GitHub. Hundreds of first-time contributors land their first PR here, usually by adding an algorithm the index didn’t have. The maintainers enforce a real style guide (Black formatter, doctest requirements, type hints encouraged), which means contributing teaches you production-quality Python conventions as a side effect. If you’re early in your Python career, opening one PR here is a genuine learning exercise.
Quality caveats
Not every implementation is optimal. Some are pedagogical (simpler but slower); some are correct but not the version you’d ship to production. The repo is honest about this: it’s a learning resource, not a library. Use it to understand the algorithm, then read its Wikipedia page or a textbook (CLRS, Sedgewick) for the production-grade variant. Do not copy code from here into production without reviewing it.
The Algorithms – Python is the executable algorithm reference. Browse it when you’re learning a new algorithm, when you’re stuck on a LeetCode question and want to see the canonical implementation, or when you want to make your first open-source PR.