Skip to content

Comments

feat(strings): add suffix automaton implementation#13606

Open
Shrithu10 wants to merge 2 commits intoTheAlgorithms:masterfrom
Shrithu10:master
Open

feat(strings): add suffix automaton implementation#13606
Shrithu10 wants to merge 2 commits intoTheAlgorithms:masterfrom
Shrithu10:master

Conversation

@Shrithu10
Copy link

@Shrithu10 Shrithu10 commented Oct 19, 2025

Describe your change:

  • Add an algorithm
  • Fix a bug or typo in an existing algorithm
  • Add or change doctests
  • Documentation change

This pull request adds an implementation of the Suffix Automaton under strings/suffix_automaton.py.

A suffix automaton is a compact automaton that recognizes all substrings of a given string.
It can be used for:

  • Fast substring checks,
  • Counting distinct substrings,
  • Longest common substring queries, etc.

Time complexity: O(n) for construction.

References:


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. To ease review, I will open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • 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.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.

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