, Volume 40, Issue 1, pp 33–50 | Cite as

Engineering a Lightweight Suffix Array Construction Algorithm



In this paper we describe a new algorithm for building the suffix array of a string. This task is equivalent to the problem of lexicographically sorting all the suffixes of the input string. Our algorithm is based on a new approach called deep–shallow sorting: we use a “shallow” sorter for the suffixes with a short common prefix, and a “deep” sorter for the suffixes with a long common prefix. All the known algorithms for building the suffix array either require a large amount of space or are inefficient when the input string contains many repeated substrings. Our algorithm has been designed to overcome this dichotomy. Our algorithm is “lightweight” in the sense that it uses very small space in addition to the space required by the suffix array itself. At the same time our algorithm is fast even when the input contains many repetitions: this has been shown by extensive experiments with inputs of size up to 110 Mb. The source code of our algorithm, as well as a C library providing a simple API, is available under the GNU GPL.

Suffix array Algorithmic engineering Space-economical algorithms Full-text index Suffix tree 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag 2004

Authors and Affiliations

  1. 1.Dipartimento di Informatica, Università del Piemonte Orientale, Alessandria, Italy, and IIT-CNR, PisaItaly
  2. 2.Dipartimento di Informatica, Università di Pisa, PisaItaly

Personalised recommendations