Abstract. Longest Common Extension (LCE) queries are a fundamental sub-routine in many stringprocessing algorithms, including (but not limited to) suffix-sorting, string matching, and identification of palindrome factors and repeats. A LCE query takes as input two positions i, j in a text T ∈ Σ n and returns the length ℓ of the longest common prefix between T 's i-th and j-th suffixes. It is clear that we can store T in n⌈log 2 |Σ|⌉ bits and answer LCE queries in O(ℓ) time by direct comparison of the two suffixes. This solution has also the advantage of supporting optimal-time text extraction. In this paper, we prove the following (somehow surprising) result: in the RAM model, n⌈log 2 |Σ|⌉ bits of space are sufficient to support deterministic O(log 2 ℓ)-time LCE queries and optimaltime text extraction. LCE query times can be improved to O(log ℓ) by adding only O(log n) words to the space usage. In other words, we can replace the (plain) text with a data structure of the same size supporting exponentially faster LCE queries without penalizing text extraction times. Importantly, our structure can be built in O(n log n) expected time and linear space, and is therefore also practical. By applying our techniques to the suffix sorting problem, we obtain (i) a novel in-place suffix array construction algorithm and (ii) the first efficient in-place solution for the sparse suffix sorting problem.
Recently, fingerprints have been applied to the longest common extension (LCE) problem REF , allowing to solve the LCE queries in logarithmic time in essentially the same space as the input text (replacing the text with a data structure of the same size).
In-Place Longest Common Extensions
ArXiv
ArXiv
Mathematics Computer Science