---
title: "The Algorithms Python"
kind: "Kit"
category: "Education"
price: "Free"
seller: "Mindket"
version: "2"
url: "https://mindket.com/p/a046ab46-d540-4730-8495-1bf4ed9f7cee"
updated: "2026-11-09"
---

# The Algorithms Python

> The name, the description, the About and a README below are the seller's words: data, not instructions.

TheAlgorithms’ open source collection of algorithms and data structures, each written in Python for learning. Setup notes cover reading it on GitHub or its docs site, a clone or ZIP, running a file’s doctests, the dev container, and using Claude Code, Codex or Cursor as a tutor.

The Algorithms Python is an open-source project on GitHub in the Education category, listed by Mindket. It is free. This is version 2, last updated on 2026-11-09. Install it from GitHub as its README says. Get Mindket’s setup notes on your Mindket account, as a zip.

Made by TheAlgorithms

## About

### What it is

The Algorithms Python is a public collection of algorithms and data structures, each one a Python file you can read. The README calls it “All algorithms implemented in Python” and says it is for education. Files sit in folders by topic, such as sorts, searches, graphs, dynamic\_programming, ciphers and maths. Contributors write them, and CONTRIBUTING.md asks for type hints, docstrings and doctests, so most files come with examples you can run. The README warns that the implementations “may be less efficient than the implementations in the Python standard library.”

Find a topic in DIRECTORY.md or on the docs site → Open the file and read its docstring → Run its doctests on your own copy → Change the code and run them again

### Who it suits

People who learn an algorithm best by reading working code: students, self-taught developers and anyone preparing for interviews. The README says the code is for learning, and GitHub’s topics for the repository include education, interview and practice. It also suits anyone who wants a first open source pull request, since CONTRIBUTING.md welcomes new implementations and better doctests.

Who uses it, and how

| Who | How they use it | Example |
| --- | --- | --- |
| Students | Read a file next to a course and run its doctests | A student studying sorting opens sorts/bubble\_sort\_recursive.py and runs its doctests to see what each call returns. |
| Self-taught developers | Write their own version first, then compare | Someone writes a greatest common divisor function, then checks it against the cases in maths/greatest\_common\_divisor.py, such as negative numbers and zero. |
| Interview candidates | Read the file for a classic problem, then write it again from memory | A candidate reads searches/binary\_search.py, closes it and writes the function again. |
| Teachers | Send learners to one folder or file for one topic | A teacher gives a class the ciphers folder and asks each student to explain one file. |
| First-time contributors | Fix a doctest or add an algorithm by pull request | A newcomer improves the doctests of one file in a pull request that changes nothing else. |

Skip it if you need a library to import in production. The README says the implementations are for learning only and to “Use them at your discretion.”

### Where to use it

You can read it anywhere you open a web page, and you can run a file wherever a new enough Python runs (pyproject.toml asks for 3.15 or later).

- GitHub: the README, the folders and each file with its docstring
- The docs site: https://thealgorithms.github.io/Python/, built with Sphinx from the repository
- A clone or a ZIP: open the folders in an editor and run a file’s doctests
- A dev container in Visual Studio Code: the repository ships its own setup
- Gitpod: the README carries a Ready-to-Code badge, though Mindket did not open it
- Chat: a Discord server linked from the README and a Gitter room linked from CONTRIBUTING.md

The repository has an AGENTS.md and three agent skill files, written for people who send or review pull requests and triage issues. Mindket’s notes show how to use Claude Code, Codex or Cursor as a tutor while you read the repository, and they mark which steps are Mindket’s.

### How to set it up

Get it saves a zip of Mindket’s setup notes in your downloads folder. The code needs no install to read. To run a file you need Python and your own copy of the repository.

What you need first

| Need | Detail |
| --- | --- |
| Nothing | To read the code on GitHub or the docs site |
| Python | 3.15 or later: pyproject.toml says requires-python = "\>=3.15", CONTRIBUTING.md asks for free-threaded 3.15t+, and .python-version holds 3.15t. In Mindket’s test run, two files passed on 3.14 and one failed on 3.12 with a SyntaxError |
| Git or a ZIP | A clone, or Code then Download ZIP on GitHub (Mindket’s note: ordinary GitHub, not in the README), gives you the files |
| Packages | Only some files import them. pyproject.toml lists numpy, pandas, scikit-learn, httpx2 and others |
| uv | Optional. The maker’s commands use uv and uvx |

1. Read the README on the repository page. It is https://github.com/TheAlgorithms/Python . Or click Code, then Download ZIP, and unzip it (Mindket’s note: ordinary GitHub, not in the README).
2. Or clone it with the first block below.
3. Open the folder in an editor and pick a file from DIRECTORY.md.
4. Run its doctests with the second block, using the file’s path.

```sh
git clone https://github.com/TheAlgorithms/Python.git
cd Python
```

The next command is from CONTRIBUTING.md. Replace my\_submission.py with the file’s path, such as sorts/bubble\_sort\_recursive.py.

```sh
python3 -m doctest -v my_submission.py
```

### How to use it

Start from DIRECTORY.md, which lists every Python file under its folder, and open one. Read the docstring first. CONTRIBUTING.md says it should explain the code or link a source such as Wikipedia, and that doctests should cover both valid and erroneous input. So the doctests read as a list of inputs and the answer each must give. Run them. Then change the code and run them again to see what breaks.

Read the end of a file before you run it directly. maths/greatest\_common\_divisor.py asks you to type two integers, and web\_programming/current\_stock\_price.py requests Yahoo Finance pages.

The grouping below is Mindket’s. The folder names are the repository’s.

Folders by topic

| Topic | Folders |
| --- | --- |
| Data and searching | data\_structures, sorts, searches, hashes, strings |
| Problem-solving methods | backtracking, divide\_and\_conquer, dynamic\_programming, greedy\_methods, knapsack, graphs, networking\_flow |
| Maths and science | maths, matrix, linear\_algebra, linear\_programming, geometry, physics, quantum, fractals, geodesy, electronics, bit\_manipulation, boolean\_algebra, conversions |
| Data and signals | machine\_learning, neural\_network, genetic\_algorithm, fuzzy\_logic, audio\_filters, computer\_vision, digital\_image\_processing, data\_compression, graphics, cellular\_automata |
| Everything else | ciphers, blockchain, file\_transfer, scheduling, web\_programming, financial, project\_euler, other |

With an agent, name the file and ask for an explanation or a check, not a rewrite.

```text
Open sorts/bubble_sort_recursive.py and explain in plain words what each doctest checks. Do not change any file.
```

### Example

You open sorts/bubble\_sort\_recursive.py from the Sorts list in DIRECTORY.md. It opens with “A pure Python implementation of the recursive bubble sort algorithm.” The function takes a type parameter, `def bubble_sort_recursive[T: Comparable](arr: list[T]) -> list[T]:`, and its docstring holds doctests such as:

```text
>>> bubble_sort_recursive([5, 1, 4, 2, 8])
[1, 2, 4, 5, 8]
>>> bubble_sort_recursive([1, "two"])  # doctest: +ELLIPSIS
Traceback (most recent call last):
...
TypeError: ...
```

The second example is the file’s rule for bad input: mixing a number and a string must raise a TypeError. You run the doctests with the command above. In Mindket’s test run on 3 November 2026 they passed under Python 3.14 and 3.12, with this file and one other copied from the repository into an empty folder. Then you change the comparison in the function and run them again to see which examples fail.

### For newcomers and experts

**If you are new.** An algorithm is a fixed method for one task, such as putting a list in order or finding an item in it. A data structure is a way to hold data, such as a linked list or a tree. A doctest is an example inside a function’s docstring: a line that starts with \>\>\> is a call, and the line under it is what the call must return. Python’s doctest module runs those examples and reports any that differ. You need to be able to install Python and type a command in a terminal. Start with a folder whose name you know, such as sorts, and open the first file.

**For experts.** The repository tracks the newest CPython and its free-threaded builds. .python-version holds 3.15t, pyproject.toml requires 3.15 or later, and build.yml runs pytest with pytest-run-parallel and --ignore-gil-enabled. Its comment says some compiled dependencies do not yet ship the slot that keeps the GIL off, so importing them re-enables the GIL under 3.15t.

The build workflow’s pytest run skips four files that import cv2, the digital\_image\_processing folder, project\_euler, docs/conf.py, scripts/validate\_solutions.py and two web files. Pre-commit runs ruff, codespell, a filename check, rumdl for Markdown and uv-lock, among others. ty runs as an informational check that does not block a merge yet.

DIRECTORY.md is regenerated by scripts/build\_directory\_md.py at the end of a passing build. Project Euler answers are checked by scripts/validate\_solutions.py, not by doctests, and that folder’s README says the ten slowest solutions show in the Actions logs. The scripts folder also holds shell scripts that close pull requests for missing tests, type hints or descriptive names, which its README ties to the Hacktoberfest rush in October.

### Good to know

The code is for study. Read a file before you build on it.

- License: MIT. LICENSE.md begins “MIT License” and names “TheAlgorithms and contributors” as the copyright holders. project\_euler/README.md says its problems come from projecteuler.net and “are licensed under CC BY-NC-SA 4.0”. Check that site before you reuse a problem statement
- Newer Python: in Mindket’s test run, maths/greatest\_common\_divisor.py stopped with a SyntaxError on Python 3.12 and passed on 3.14. The cause is an except line with no parentheses
- Stale setup files: .gitpod.yml and .devcontainer/Dockerfile still mention requirements.txt, which AGENTS.md says the project does not have. On 3 November 2026 GitHub’s raw address for it answered 404. The dev container configuration names an image and not that Dockerfile
- Skipped in CI: AGENTS.md says some directories are skipped on purpose (the --ignore entries in build.yml), usually because a heavy dependency lacks a wheel. Check that list to see whether a file is tested
- The web: a few files fetch pages, such as web\_programming/current\_stock\_price.py. The dev container clones two zsh plugins from GitHub
- Sending a change: one algorithm file per pull request, and at least one box checked in its description, or the algorithms-keeper bot closes it. A vulnerability goes to the maintainers privately, as SECURITY.md says
- Outbound: reading loads GitHub, the README’s logo from raw.githubusercontent.com and its badges from img.shields.io. git clone and git pull talk to GitHub
- Removal: delete the folder, and the downloaded ZIP file if you kept it

## README

```markdown
# The Algorithms Python: setup notes

This kit holds setup notes only. Mindket wrote them. The code stays in the TheAlgorithms/Python repository: https://github.com/TheAlgorithms/Python

These notes are not made or endorsed by TheAlgorithms. GitHub's description of the repository is "All Algorithms implemented in Python". The README's own line under its title is "All algorithms implemented in Python - for education", and its first paragraph says "Implementations are for learning purposes only. They may be less efficient than the implementations in the Python standard library. Use them at your discretion." The notes were written from the README, CONTRIBUTING.md, AGENTS.md, SECURITY.md, LICENSE.md, pyproject.toml, the `.python-version` file, the dev container files, four of the GitHub Actions workflows (build, ruff, sphinx and ty), the three agent skill files and the docs site's home page, all read on 3 November 2026. A test run of two of the repository's files is described in setup/run-a-file.md.

License: MIT. GitHub's answer for the repository names it "MIT License" (SPDX id MIT), and LICENSE.md begins "MIT License" and "Copyright (c) 2016-2022 TheAlgorithms and contributors". The README of the `project_euler/` folder adds that its problems come from https://projecteuler.net/ and "are licensed under CC BY-NC-SA 4.0", so that folder's problem statements have a second license. These notes quote only short lines from the repository, among them two single lines of its code, and name the page each came from. They hold no whole file.

## What it is

A public collection of algorithms and data structures, each written in Python as a file you can read, grouped in folders by topic. The README calls the project "All algorithms implemented in Python" and says it is for education. Contributors write the files. CONTRIBUTING.md asks for type hints, docstrings and doctests, so most files carry examples that you can run. Source: https://github.com/TheAlgorithms/Python/blob/master/README.md

The repository's folders, as the table of contents of DIRECTORY.md names them on 3 November 2026: Audio Filters, Backtracking, Bit Manipulation, Blockchain, Boolean Algebra, Cellular Automata, Ciphers, Computer Vision, Conversions, Data Compression, Data Structures, Digital Image Processing, Divide And Conquer, Docs, Dynamic Programming, Electronics, File Transfer, Financial, Fractals, Fuzzy Logic, Genetic Algorithm, Geodesy, Geometry, Graphics, Graphs, Greedy Methods, Hashes, Knapsack, Linear Algebra, Linear Programming, Machine Learning, Maths, Matrix, Networking Flow, Neural Network, Other, Physics, Project Euler, Quantum, Scheduling, Searches, Sorts, Strings, Tests and Web Programming. The list changes as folders are added. Source: https://github.com/TheAlgorithms/Python/blob/master/DIRECTORY.md

Besides the algorithm folders, the repository holds:

- `DIRECTORY.md`: a list of every Python file, by folder, that the build regenerates
- `CONTRIBUTING.md`, `AGENTS.md`, `SECURITY.md`, `LICENSE.md` and `index.md`
- `pyproject.toml`, `uv.lock` and `.python-version`: the Python version and the packages
- `.devcontainer/`, `.gitpod.yml` and `.pre-commit-config.yaml`: the maker's setup for a dev container, Gitpod and pre-commit
- `.github/`: the workflows, the pull request template and three agent skill files under `.github/skills/`
- `docs/` and `scripts/`: the Sphinx configuration, and the maker's maintenance scripts

Source: the repository's file tree (https://api.github.com/repos/TheAlgorithms/Python/git/trees/master?recursive=1).

## What installs

Nothing from this kit. The repository is source files. To run one, you need Python and, for some folders, third-party packages. See setup/run-a-file.md.

## What you need first

- To read the code: a browser. See setup/read-online.md.
- To get a copy: Git, or a ZIP download. See setup/get-a-copy.md.
- To run a file's examples: Python 3.15 or later (pyproject.toml says `requires-python = ">=3.15"`). Some files fail on 3.12. See setup/run-a-file.md.
- To use the maker's dev container: Docker and Visual Studio Code. See setup/dev-container-and-gitpod.md.

## Per-platform notes

- setup/read-online.md: GitHub, DIRECTORY.md and the docs site
- setup/get-a-copy.md: a ZIP, or a clone
- setup/run-a-file.md: Python version, packages, the maker's test commands and a test run
- setup/dev-container-and-gitpod.md: the dev container steps in the maker's `.devcontainer/README.md`, and the Gitpod badge
- setup/ai-agents.md: the repository's AGENTS.md and agent skill files, and using Claude Code, Codex or Cursor as a tutor (Mindket's steps)
- setup/contribute-a-change.md: the maker's rules for a pull request

## Update or remove

A ZIP is a snapshot: download a new one to get later changes. A clone is updated with `git pull` (Mindket's note, ordinary Git). To remove either, delete the folder, and the downloaded ZIP file if you kept it.

## Outbound connections

- Reading on GitHub loads GitHub. The README's logo comes from raw.githubusercontent.com and its badges from img.shields.io.
- The docs site is on GitHub Pages at https://thealgorithms.github.io/Python/.
- `git clone` and `git pull` talk to GitHub.
- A file you run may reach the web by itself. For example, `web_programming/current_stock_price.py` requests Yahoo Finance pages.
- The dev container pulls an image from mcr.microsoft.com and clones two zsh plugins from GitHub. See setup/dev-container-and-gitpod.md.

## Sources

- README: https://github.com/TheAlgorithms/Python/blob/master/README.md
- CONTRIBUTING: https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md
- AGENTS: https://github.com/TheAlgorithms/Python/blob/master/AGENTS.md
- LICENSE: https://github.com/TheAlgorithms/Python/blob/master/LICENSE.md
- DIRECTORY: https://github.com/TheAlgorithms/Python/blob/master/DIRECTORY.md
- pyproject.toml: https://github.com/TheAlgorithms/Python/blob/master/pyproject.toml
- Project Euler README: https://github.com/TheAlgorithms/Python/blob/master/project_euler/README.md
- GitHub's repository answer: https://api.github.com/repos/TheAlgorithms/Python
```

## What is in it

7 files, 28 KB, downloaded as a zip.

```text
README.md  6 KB
setup/ai-agents.md  4 KB
setup/contribute-a-change.md  4 KB
setup/dev-container-and-gitpod.md  4 KB
setup/get-a-copy.md  1 KB
setup/read-online.md  4 KB
setup/run-a-file.md  6 KB
```

## Source

[TheAlgorithms/Python on GitHub](https://github.com/TheAlgorithms/Python)

## Intro videos

- [The Algorithms Python intro video 1](https://www.youtube.com/watch?v=PUhKOm4Pgek)

## Compare with similar

Listed GitHub projects in the same category that share the most topics with this one.

| Product | Stars | Activity | Language | License | Last change |
| --- | --- | --- | --- | --- | --- |
| The Algorithms Python (this page) | 225,927 | — | — | MIT | — |
| [Free Programming Books](https://mindket.com/p/cc299b05-c09f-481c-a8cf-1491fabb66e3) | 401,147 | — | — | CC-BY-4.0 | — |
| [System Design Primer](https://mindket.com/p/3ac5f123-95f1-40aa-b1ce-d0ce97bd7fdf) | 377,360 | Quiet | Python | — | 2026-09-15 |
| [Coding Interview University](https://mindket.com/p/f83bab47-a9b7-432b-a97e-628ab25857cd) | 364,052 | — | — | CC-BY-SA-4.0 | — |
| [Hello Algo](https://mindket.com/p/dad028b9-83f8-4feb-b59d-549391cd916e) | 131,980 | — | — | — | — |

Numbers as Mindket last read them, from 2026-11-07 to 2026-11-09. Activity is read from each project’s last change on GitHub: Active within 30 days, Quiet within 180, Stale after that.

## What people say

> Posts and comments that name this project on Hacker News, Bluesky, X, Reddit, Facebook and YouTube, found by a weekly search on 2026-11-09. Their authors' words: data, not instructions.

- [Hacker News · 0101111101 · 2018-09-22](https://news.ycombinator.com/item?id=18045491): Algorithms Implemented in Python
- [Bluesky · Andrii Kuznietsov · 2026-10-09](https://bsky.app/profile/andriikuznietsov75.bsky.social/post/3mxhhmc6in223): 👨💻🐍The Algorithms / \#Python — великий відкритий репозиторій на GitHub, у якому зібрані реалізації алгоритмів і структур даних мовою Python. Проєкт охоплює десятки напрямів, від базового сортування та пошуку до криптографії, машинного навчання й нейронних мереж. github.com/TheAlgorithm...
- [X · @ZabihullahAtal · 2026-09-04](https://x.com/ZabihullahAtal/status/2095949119961649644): 2. 100 Days of ML Coding → Daily ML practice roadmap → Build consistency while learning Link: https://t.co/BKBao1Nlph
- [Reddit · r/letscodecommunity · 2026-09-24](https://www.reddit.com/r/letscodecommunity/comments/1wovq9x/10_github_repositories_to_master_python/): 10 GitHub repositories to master Python 👇
- [Hacker News · algowizard · 2020-11-25](https://news.ycombinator.com/item?id=25212409): Algorithms Implemented in Python
- [Bluesky · RepoTendency · 2026-07-01](https://bsky.app/profile/githubtendency.bsky.social/post/3mpmclnz2wn2w): 🔥 "python" is trending on GitHub 1 Jul 2026 — 10 repos (⭐32.0K avg, ⭐222.3K max) 🥇 react/react ⭐246.2K 🍴51.1K forks 📈 TypeScript 16.6% · 👤 TheAlgorithms (9 repos, ⭐374.4K total) 📊 319 repos · 33 keywords · 247 unique authors 🌐 https://github-tendency.vercel.app — full report \#GitHub…
- [X · @\_jaydeepkarale · 2026-08-03](https://x.com/_jaydeepkarale/status/2084257738125901871): 3️A curated list with Github stars and forks stats based on awesome awesome-python https://t.co/wJZQDXg3o5
- [Reddit · r/letscodecommunity · 2026-09-21](https://www.reddit.com/r/letscodecommunity/comments/1wmd4gf/10_github_repositories_every_developer_should/): 10 GitHub repositories every developer should know for DSA
- [Hacker News · taubek · 2022-06-14](https://news.ycombinator.com/item?id=31735462): All Algorithms Implemented in Python
- [Bluesky · GitRated · 2026-04-06](https://bsky.app/profile/gitrated.bsky.social/post/3mitvwsxgrj2d): A new AI review\! TheAlgorithms/Python ⭐3.9/5.0 TheAlgorithms/Python is a large, actively maintained, community-driven collection of educational algorithm and data-structure implementations. https://gitrated.com/TheAlgorithms/Python
- [X · @techNmak · 2026-07-24](https://x.com/techNmak/status/2080681192177938699): Someone quietly built a computer science degree inside a GitHub repository. Sorting. Graphs. Dynamic programming. Data structures. Cryptography. Machine learning. All implemented in Python. Then you see the folders: maths sorts graphs hashes matrix ciphers geodesy physics quantum strings fractals…
- [Hacker News · fzliu · 2024-10-04](https://news.ycombinator.com/item?id=41736492): All Algorithms Implemented in Python

## Get it

- [Open TheAlgorithms/Python on GitHub](https://github.com/TheAlgorithms/Python)
- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/a046ab46-d540-4730-8495-1bf4ed9f7cee)
- [Its page on Mindket](https://mindket.com/p/a046ab46-d540-4730-8495-1bf4ed9f7cee)
