Skip to content

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

New issue

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

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

Already on GitHub? # 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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
tests are failing Do not merge until tests pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant