Skip to content

Add 15 community-contributed algorithms#2718

Merged
keon merged 1 commit into
mainfrom
feature/community-algorithms
Feb 17, 2026
Merged

Add 15 community-contributed algorithms#2718
keon merged 1 commit into
mainfrom
feature/community-algorithms

Conversation

@keon
Copy link
Copy Markdown
Owner

@keon keon commented Feb 17, 2026

Summary

  • Adds 15 new algorithm implementations inspired by ideas from reviewed community PRs, rewritten from scratch to match the repo's code standards (type hints, docstrings, complexity notes, from __future__ import annotations)
  • Includes 70 new tests (485 total, all passing) and README entries for every addition

New algorithms

Category Algorithm Inspired by
Backtracking Minimax with alpha-beta pruning PR #860
Bit Manipulation Gray code generation & conversion PR #932
Data Structures KD-tree with nearest-neighbor search PR #915
Dynamic Programming Bitmask TSP PR #855
Dynamic Programming Grid path counting (3 approaches) PR #857
Graph Edmonds' blossom maximum matching PR #826
Math Linear regression (OLS + R² + RMSE) PR #871
Math Manhattan distance (n-dimensional) PR #877
Math Polynomial long division PR #840
Searching Exponential search PR #867
Searching Sentinel search PR #907
String Alphabet board path PR #897
String Manacher's O(n) palindrome PR #931
String Swap characters to equal PR #890
String Z-algorithm pattern matching PR #930

Test plan

  • All 485 tests pass (python -m pytest tests/ -x -q)
  • Ruff linter passes clean (ruff check .)
  • Each new algorithm has comprehensive tests in tests/test_community_algorithms.py
  • All __init__.py exports updated
  • README updated with entries for all 15 algorithms + KD-tree in data structures table

🤖 Generated with Claude Code

Implements algorithm ideas from reviewed open PRs, rewritten to match
the repo's code standards (type hints, docstrings, complexity notes):

- backtracking: minimax with alpha-beta pruning
- bit_manipulation: Gray code generation and conversion
- data_structures: KD-tree with nearest-neighbor search
- dynamic_programming: bitmask TSP, grid path counting (3 approaches)
- graph: Edmonds' blossom algorithm for maximum matching
- math: linear regression (OLS + R² + RMSE), Manhattan distance,
  polynomial long division
- searching: exponential search, sentinel search
- string: alphabet board path, Manacher's palindrome, swap characters,
  Z-algorithm pattern matching

Includes 70 new tests (485 total) and README entries for all additions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@keon keon merged commit fb0f681 into main Feb 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant