CodeVetter · Repo Unpack · Feature catalog
TheAlgorithms/Python
'Features' here are per-topic algorithm collections rather than product features: ~45 directories covering classic CS domains (sorts, searches, graphs, data_structures, dynamic_programming, ciphers, strings, maths), applied domains (machine_learning, neural_network, computer_vision, digital_image_processing, physics, electronics, financial, geodesy), curiosities (fractals, cellular_automata, fuzzy_logic, genetic_algorithm, quantum), a 344-file project_euler/ tree with a strict solution() contract, and web_programming/ scrapers that hit live third-party sites. Every module is directly runnable via its __main__ block and self-testing via doctests.
- sorts/ contains ~60 comparison and non-comparison sorts; sorts/bubble_sort.py alone ships bubble_sort_iterative and bubble_sort_recursive behind a shared Comparable Protocol and exercises a timing benchmark in its __main__ block.
- project_euler/ holds per-problem packages problem_NNN/ with multiple solN.py variants, each exposing a solution() function whose default arguments answer the problem (e.g. problem_001/sol1.py solution(n: int = 1000)).
- web_programming/ is a set of live scrapers/API clients: current_stock_price.py fetches Yahoo Finance HTML and parses a data-testid span with BeautifulSoup; fetch_anime_and_play.py scrapes gogoanime2.org search/episode/download URLs using fake-useragent.
- Other web_programming modules cover Hacker News, IMDb top-250 CSV export, COVID stats via XPath, GitHub info, currency conversion, Slack messages, reCAPTCHA verification, Reddit, NASA data, and Google result crawling — each a standalone network client.
- data_structures/ (144 files) implements linked lists, stacks/queues, hash maps, binary trees, kd-trees, suffix trees, tries, disjoint sets, and hashing — several with dedicated tests/ subdirectories (e.g. hashing/tests/test_hash_map.py, kd_tree/tests/test_kdtree.py).
- maths/ (217 files) is the largest non-Euler domain — primality tests, factorials, number theory, geometry helpers — with sibling test files like test_prime_check.py and test_factorial.py alongside implementations.
- file_transfer/send_file.py + receive_file.py demonstrate raw TCP socket file transfer on port 12312, with a testing flag so tests/test_send_file.py can exercise one accept loop.
- machine_learning/ and neural_network/ implement algorithms from scratch (linear regression, sequential minimal optimization for SVM, LSTM prediction, input_data MNIST loader) rather than being thin wrappers, per CONTRIBUTING.md's 'add unique value' rule.
- graphs/ (69 files) covers traversal, shortest paths (Floyd-Warshall, Johnson), minimum spanning trees (Kruskal, Prim), and flow networks, with a graphs/tests/ subdirectory of pytest modules.
- ciphers/ (56 files) implements classical and modern ciphers; hashes/enigma_machine.py is one of a few files granted a per-file ruff ignore (BLE001 blind-except) in pyproject.toml.
- quantum/q_fourier_transform.py is the single module importing qiskit; it is skipped in the 3.14t CI run because qiskit re-enables the GIL under free threading.
- digital_image_processing/ is almost entirely cv2-based and is excluded wholesale from the free-threaded test run until a cp314t opencv wheel ships.