Take any string — say banana. A suffix is the tail starting at some position: banana, anana, nana, ana, na, a. Sort those six suffixes alphabetically and you get a neat ranked list. That ranked list, stored as an array of start positions, is the suffix array (SA).
Why bother? With a suffix array you can binary-search for any pattern in time ( = pattern length, = text length), locate all occurrences in seconds, and answer dozens of string questions — longest repeated substring, longest common substring of two texts, compression statistics — in linear time using the companion LCP array (longest common prefix between consecutive suffixes).
The catch is construction. Sorting suffixes naively costs comparisons because each comparison can touch up to characters. For a human genome () that is completely off the table. The race to reach time took decades, produced three independent solutions around 2003–2009, and remains one of the cleanest stories in algorithm design.
Comments
Loading comments...