Skip to content

Rename algorithms/map/longest_common_subsequence.py -> longest_common_substring.py#2756

Merged
keon merged 1 commit into
mainfrom
fix/rename-map-lcs-to-substring
May 18, 2026
Merged

Rename algorithms/map/longest_common_subsequence.py -> longest_common_substring.py#2756
keon merged 1 commit into
mainfrom
fix/rename-map-lcs-to-substring

Conversation

@keon
Copy link
Copy Markdown
Owner

@keon keon commented May 18, 2026

Summary

  • The file under `algorithms/map/` is misnamed: it actually implements longest common substring (contiguous), not subsequence. The module docstring, the function name (`max_common_sub_string`), and the Wikipedia reference URL inside the file all already say "substring" — only the filename was wrong.
  • The true longest common subsequence already lives in `algorithms/dynamic_programming/longest_common_subsequence.py`.
  • Updates the single import site in `algorithms/map/init.py`. The exported symbol name (`max_common_sub_string`) is unchanged, so no test or downstream caller needs to change.

Closes #2747.

Test plan

  • `pytest tests/test_map.py` → 25 passed
  • `from algorithms.map import max_common_sub_string` resolves and `max_common_sub_string("abcdef", "acdbef")` returns `"cd"`

🤖 Generated with Claude Code

…_substring.py

The file under algorithms/map/ actually implements longest common
*substring* (contiguous), not longest common subsequence. The module
docstring, the function name (`max_common_sub_string`), and the Wikipedia
reference URL inside the file all already say "substring" — only the
filename was wrong. The true longest common subsequence lives in
algorithms/dynamic_programming/longest_common_subsequence.py.

Updates the single import site in algorithms/map/__init__.py. The
exported symbol name (`max_common_sub_string`) is unchanged, so no
test or downstream caller needs to change.

Closes #2747.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@keon keon merged commit 6dfba95 into main May 18, 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.

Name of file does not match with the algorithm implemented in that file.

1 participant