Skip to main content
QUICK REVIEW

[Paper Review] Optimal Time and Space Construction of Suffix Arrays and LCP Arrays for Integer Alphabets

Keisuke Goto|arXiv (Cornell University)|Mar 3, 2017
Algorithms and Data CompressionComputer Science22 references11 citations
TL;DR

This paper presents the first in-place, linear-time algorithms for constructing suffix arrays (SA) and longest common prefix (LCP) arrays for integer alphabets, using only O(1) extra words beyond input and output. By compactly storing the type array and auxiliary data structures within the output space, the method achieves optimal time and space complexity for both SA and LCP construction, resolving an open problem in string algorithms.

ABSTRACT

Suffix arrays and LCP arrays are one of the most fundamental data structures widely used for various kinds of string processing. We consider two problems for a read-only string of length $N$ over an integer alphabet $[1, \dots, σ]$ for $1 \leq σ\leq N$, the string contains $σ$ distinct characters, the construction of the suffix array, and a simultaneous construction of both the suffix array and LCP array. For the word RAM model, we propose algorithms to solve both of the problems in $O(N)$ time by using $O(1)$ extra words, which are optimal in time and space. Extra words means the required space except for the space of the input string and output suffix array and LCP array. Our contribution improves the previous most efficient algorithms, $O(N)$ time using $σ+O(1)$ extra words by [Nong, TOIS 2013] and $O(N \log N)$ time using $O(1)$ extra words by [Franceschini and Muthukrishnan, ICALP 2007], for constructing suffix arrays, and it improves the previous most efficient solution that runs in $O(N)$ time using $σ+ O(1)$ extra words for constructing both suffix arrays and LCP arrays through a combination of [Nong, TOIS 2013] and [Manzini, SWAT 2004].

Motivation & Objective

  • To resolve the open problem of constructing suffix arrays in linear time and in-place for integer alphabets.
  • To simultaneously construct both suffix arrays and LCP arrays in optimal time and space.
  • To reduce the space complexity of existing linear-time algorithms from O(σ) to O(1) extra words.
  • To enable efficient in-place computation of the LCP array via an in-place transformation of the ψ array.
  • To provide a practical and space-efficient solution for string processing workloads requiring enhanced suffix arrays.

Proposed method

  • The algorithm uses the induced sorting framework, storing the type array and LCP auxiliary arrays within the output suffix array space to achieve O(1) extra words.
  • It employs a compact representation of suffixes and elements of the LE array by utilizing the most significant bits (MSBs) of the output array as storage for the type array.
  • The method leverages two key properties: (1) the first character of a suffix corresponds to its stored index, and (2) the preceding character differs from the current character for L-suffixes and LMS-suffixes.
  • It computes the ψ array (rank next array) in-place using a left-to-right scan on the inverse suffix array (ISA), then converts it to the LCP array in-place.
  • The algorithm avoids stable merging by reusing the structure of the LMS-suffix sorting process, reducing space and time overhead.
  • A simplified in-place method for storing recursive subarray boundaries is used, enabling O(1) access time instead of O(log N).

Experimental results

Research questions

  • RQ1Can suffix arrays be constructed in O(N) time and O(1) extra space for integer alphabets?
  • RQ2Can both suffix arrays and LCP arrays be constructed simultaneously in optimal time and space?
  • RQ3Is it possible to store the type array and auxiliary data structures within the output space without increasing extra memory?
  • RQ4Can the LCP array be computed in-place from the suffix array using only O(1) extra words?
  • RQ5Does the proposed method outperform prior in-place algorithms in terms of time and space efficiency?

Key findings

  • The paper presents the first algorithm that constructs suffix arrays in O(N) time and O(1) extra words for integer alphabets, achieving optimal time and space complexity.
  • The method stores the type array and auxiliary data structures (e.g., LE array) within the output suffix array space by using unused bits, enabling in-place operation.
  • The algorithm computes the LCP array in-place by transforming the ψ array using a left-to-right scan on the inverse suffix array, requiring no additional space.
  • The approach improves upon prior work by Nong (TOIS 2013), which required σ + O(1) extra words, and Franceschini and Muthukrishnan (ICALP 2007), which required O(N log N) time.
  • The method achieves optimal time and space for both SA and LCP construction, resolving an open problem in string algorithms.
  • A simplified in-place technique for storing recursive subarray boundaries is proposed, enabling O(1) access time instead of O(log N).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.