Skip to content

feat(strings): add professional suffix array and LCP implementation #12817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

idrisibrahimerten
Copy link

Describe your change:

  • Add an algorithm?
    – Added a professional Suffix Array construction (build_suffix_array) using the doubling method and LCP Array construction (build_lcp_array) via Kasai’s algorithm in strings/suffix_array.py.

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file.
  • All new Python files are placed inside an existing directory (strings/).
  • All filenames are in all lowercase characters with no spaces or dashes (suffix_array.py).
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.

```python

build_suffix_array("banana")
[5, 3, 1, 0, 4, 2]
build_lcp_array("banana", build_suffix_array("banana"))
[1, 3, 0, 0, 2]
```

If you filed a corresponding issue (e.g. “Add suffix array”), add at the bottom of “Describe your change”:
Fixes #1234

@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests are failing Do not merge until tests pass
1 participant