<p>Sparse suffix sorting is the problem of sorting <InlineEquation ID="IEq1"> <EquationSource Format="TEX">\(b=o(n)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi>b</mi> <mo>=</mo> <mi>o</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation> suffixes of a string of length <i>n</i>. Efficient sparse suffix sorting algorithms have existed for more than a decade. Despite the multitude of works and their justified claims for applications in text indexing, the existing algorithms have not been employed by practitioners. Arguably this is because there are no simple, direct, <i>and</i> efficient algorithms for sparse suffix array construction. We provide two new algorithms for constructing the sparse suffix and LCP arrays that are simultaneously simple, direct, small, and fast. In particular, our algorithms are: <i>simple</i> in the sense that they can be implemented using only basic data structures; <i>direct</i> in the sense that the output arrays are not a byproduct of constructing the sparse suffix tree or an LCE data structure; <i>fast</i> in the sense that they run in <InlineEquation ID="IEq2"> <EquationSource Format="TEX">\(\mathcal {O}(n\log b)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo>log</mo> <mi>b</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation> time, in the worst case, or in <InlineEquation ID="IEq3"> <EquationSource Format="TEX">\(\mathcal {O}(n)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation> time, when the total number of suffixes with an LCP value greater than <InlineEquation ID="IEq4"> <EquationSource Format="TEX">\(2^{\lfloor \log \frac{n}{b} \rfloor + 1}-1\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <msup> <mn>2</mn> <mrow> <mo>⌊</mo> <mo>log</mo> <mfrac> <mi>n</mi> <mi>b</mi> </mfrac> <mo>⌋</mo> <mo>+</mo> <mn>1</mn> </mrow> </msup> <mo>-</mo> <mn>1</mn> </mrow> </math></EquationSource> </InlineEquation> is in <InlineEquation ID="IEq5"> <EquationSource Format="TEX">\(\mathcal {O}(b/\log b)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <mi>b</mi> <mo stretchy="false">/</mo> <mo>log</mo> <mi>b</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation>, matching the time of optimal yet much more complicated algorithms [Gawrychowski and Kociumaka, SODA 2017; Birenzwige et al., SODA 2020]; and <i>small</i> in the sense that they can be implemented using <i>only</i> <InlineEquation ID="IEq6"> <EquationSource Format="TEX">\(8b+o(b)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mn>8</mn> <mi>b</mi> <mo>+</mo> <mi>o</mi> <mo stretchy="false">(</mo> <mi>b</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation> machine words. Our algorithms are non-trivial space-efficient adaptations of the Monte Carlo algorithm by I et al.&#xa0;for constructing the sparse suffix tree in <InlineEquation ID="IEq7"> <EquationSource Format="TEX">\(\mathcal {O}(n\log b)\)</EquationSource> <EquationSource Format="MATHML"><math> <mrow> <mi mathvariant="script">O</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo>log</mo> <mi>b</mi> <mo stretchy="false">)</mo> </mrow> </math></EquationSource> </InlineEquation> time [STACS 2014]. We provide extensive experiments to justify our claims on simplicity and on efficiency. A preliminary version of this paper appeared in the proceedings of LATIN 2024.</p>

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Sparse Suffix and LCP Array: Simple, Direct, Small, and Fast

  • Lorraine A. K. Ayad,
  • Grigorios Loukides,
  • Solon P. Pissis,
  • Hilde Verbeek

摘要

Sparse suffix sorting is the problem of sorting \(b=o(n)\) b = o ( n ) suffixes of a string of length n. Efficient sparse suffix sorting algorithms have existed for more than a decade. Despite the multitude of works and their justified claims for applications in text indexing, the existing algorithms have not been employed by practitioners. Arguably this is because there are no simple, direct, and efficient algorithms for sparse suffix array construction. We provide two new algorithms for constructing the sparse suffix and LCP arrays that are simultaneously simple, direct, small, and fast. In particular, our algorithms are: simple in the sense that they can be implemented using only basic data structures; direct in the sense that the output arrays are not a byproduct of constructing the sparse suffix tree or an LCE data structure; fast in the sense that they run in \(\mathcal {O}(n\log b)\) O ( n log b ) time, in the worst case, or in \(\mathcal {O}(n)\) O ( n ) time, when the total number of suffixes with an LCP value greater than \(2^{\lfloor \log \frac{n}{b} \rfloor + 1}-1\) 2 log n b + 1 - 1 is in \(\mathcal {O}(b/\log b)\) O ( b / log b ) , matching the time of optimal yet much more complicated algorithms [Gawrychowski and Kociumaka, SODA 2017; Birenzwige et al., SODA 2020]; and small in the sense that they can be implemented using only \(8b+o(b)\) 8 b + o ( b ) machine words. Our algorithms are non-trivial space-efficient adaptations of the Monte Carlo algorithm by I et al. for constructing the sparse suffix tree in \(\mathcal {O}(n\log b)\) O ( n log b ) time [STACS 2014]. We provide extensive experiments to justify our claims on simplicity and on efficiency. A preliminary version of this paper appeared in the proceedings of LATIN 2024.