Skip to content

Suffix Array Linear Time Construction #1050

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
sam20908 opened this issue Feb 26, 2023 · 1 comment
Open

Suffix Array Linear Time Construction #1050

sam20908 opened this issue Feb 26, 2023 · 1 comment

Comments

@sam20908
Copy link

There exist algorithms that construct the suffix array in linear time (given that the number of alphabets is constant). An example algorithm that's known is small/large suffixes. It would be nice for the article to go over such algorithms.

@PeroxideParadox
Copy link

Hi @adamant-pwn ,

I would like to contribute an efficient implementation of the suffix array construction algorithm in linear time (O(n)), using the SA-IS (Suffix Array Induced Sorting) algorithm or also called Skew Algorithm.

Key Steps:

  1. Suffix Partitioning: The suffixes of a string are divided into three groups based on their positions:

    • (0 \mod 3)
    • (1 \mod 3)
    • (2 \mod 3)
  2. Recursive Sorting: Suffixes from the (1 \mod 3) and (2 \mod 3) groups are sorted using radix sort, recursively processing until a small enough set is reached.

  3. Merging: The sorted (1 \mod 3) and (2 \mod 3) suffixes are merged with the (0 \mod 3) suffixes to form the final sorted order.
    The Skew algorithm is notable for its combination of partitioning, recursion, and efficient merging to achieve linear-time suffix array construction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants