Two Space Saving Tricks for Linear Time LCP Array Computation
In this paper we consider the linear time algorithm of Kasai et al.  for the computation of the Longest Common Prefix (LCP) array given the text and the suffix array. We show that this algorithm can be implemented without any auxiliary array in addition to the ones required for the input (the text and the suffix array) and the output (the LCP array). Thus, for a text of length n, we reduce the space occupancy of this algorithm from 13n bytes to 9n bytes.
We also consider the problem of computing the LCP array by “overwriting” the suffix array. For this problem we propose an algorithm whose space occupancy can be bounded in terms of the empirical entropy of the input text. Experiments show that for linguistic texts our algorithm uses roughly 7n bytes. Our algorithm makes use of the Burrows-Wheeler Transform even if it does not represent any data in compressed form. To our knowledge this is the first application of the Burrows-Wheeler Transform outside the domain of data compression.
The source code for the algorithms described in this paper has been included in the lightweight suffix sorting package  which is freely available under the GNU GPL.
Unable to display preview. Download preview PDF.
- 2.Burrows, M., Wheeler, D.: A block sorting lossless data compression algorithm. Technical Report 124, Digital Equipment Corporation (1994)Google Scholar
- 3.Ferragina, P., Manzini, G.: Compression boosting in optimal linear time using the Burrows-Wheeler transform. In: Proc. 15th ACM-SIAM Symposium on Discrete Algorithms, SODA 2004 (2004)Google Scholar
- 4.Hon, W., Sadakane, K., Sung, W.: Breaking a time-and-space barrier in constructing full-text indices. In: Proc. of the 44th IEEE Symposium on Foundations of Computer Science, pp. 251–260 (2003)Google Scholar
- 12.Manzini, G.: Two space saving tricks for linear time LCP computation. Technical Report TR-INF-2004-02-03-UNIPMN, Dipartimento di Informatica, Università Piemonte Orientale (2004), http://www.di.unipmn.it
- 13.Manzini, G., Ferragina, P.: Lightweight suffix sorting home page., http://www.mfn.unipmn.it/~manzini/lightweight
- 14.Manzini, G., Ferragina, P.: Engineering a lightweight suffix array construction algorithm. Algorithmica (2004) (to appear) ; Preliminary version in Proc. 10th European Symposium on Algorithms (ESA 2002)Google Scholar
- 15.Sadakane, K.: Succinct representations of LCP information and improvements in the compressed suffix arrays. In: Proc. 13th Annual ACM-SIAM Symp. on Discrete Algorithms (SODA 2002), pp. 225–232 (2002)Google Scholar