Lably
Skip to content

Suffix array

Data structure for a string

  • 13 min read
  • 8 chapters

Related on Lably

Through Computer science, String (computer science) and Data structure

Suffix arrays were introduced by Manber & Myers (1990) as a simple, space efficient alternative to suffix trees. They had independently been discovered by Gaston Gonnet in 1987 under the name PAT array (Gonnet, Baeza-Yates & Snider 1992).

Li, Li & Huo (2016) gave the first in-place O(n) time suffix array construction algorithm that is optimal both in time and space, where in-place means that the algorithm only needs O(1) additional space beyond the input string and the output suffix array.

Enhanced suffix arrays (ESAs) are suffix arrays with additional tables that reproduce the full functionality of suffix trees preserving the same time and memory complexity. A sorted array of only some (rather than all) suffixes of a string is called a sparse suffix array.

Definition

Let S=S[1]S[2]...S[n] be an n-string and let S[i,j] denote the substring of S ranging from i to j inclusive.

The suffix array A of S is now defined to be an array of integers providing the starting positions of suffixes of S in lexicographical order. This means, an entry A[i] contains the starting position of the i-th smallest suffix in S and thus for all 1≤i≤n: S[A[i−1],n]<S[A[i],n].

Each suffix of S shows up in A exactly once. Suffixes are simple strings. These strings are sorted (as in a paper dictionary), before their starting positions (integer indices) are saved in A.

Sign in to keep reading

7 more chapters are free with a Lably account.

More in Computing and communication