Skip to main content
QUICK REVIEW

[Paper Review] Faster Longest Common Extension Queries in Strings over General Alphabets

Paweł Gawrychowski, Tomasz Kociumaka|arXiv (Cornell University)|Feb 1, 2016
Algorithms and Data CompressionComputer Science12 references3 citations
TL;DR

This paper presents a faster algorithm for answering Longest Common Extension (LCE) queries on strings over general ordered alphabets, achieving O(q log log n + n log* n) total time for q queries with O(q + n) symbol comparisons. It improves upon prior work by using recursive short LCE queries with difference covers and efficient Union-Find structures, enabling O(n log log n) time for computing all runs in a string, a major step toward linear-time LCE computation.

ABSTRACT

Longest common extension queries (often called longest common prefix queries) constitute a fundamental building block in multiple string algorithms, for example computing runs and approximate pattern matching. We show that a sequence of $q$ LCE queries for a string of size $n$ over a general ordered alphabet can be realized in $O(q \log \log n+n\log^*n)$ time making only $O(q+n)$ symbol comparisons. Consequently, all runs in a string over a general ordered alphabet can be computed in $O(n \log \log n)$ time making $O(n)$ symbol comparisons. Our results improve upon a solution by Kosolobov (Information Processing Letters, 2016), who gave an algorithm with $O(n \log^{2/3} n)$ running time and conjectured that $O(n)$ time is possible. We make a significant progress towards resolving this conjecture. Our techniques extend to the case of general unordered alphabets, when the time increases to $O(q\log n + n\log^*n)$. The main tools are difference covers and the disjoint-sets data structure.

Motivation & Objective

  • To improve the time complexity of answering a sequence of LCE queries on strings over general ordered alphabets.
  • To reduce the total time for computing all runs in a string, a fundamental string processing task.
  • To address Kosolobov's open question on whether O(n) time is achievable for O(n) LCE queries in the comparison model.
  • To extend the approach to general unordered alphabets, where only equality comparisons are allowed.

Proposed method

  • Using a recursive approach to compute min(LCE(i,j), t) for t = polylog n, leveraging efficient Union-Find data structures to manage character comparisons.
  • Employing difference covers to sample key positions in the string, enabling sparse suffix array construction for efficient LCE computation.
  • Introducing multiple levels of difference covers with specific structural properties to control the amortized cost of Union-Find operations.
  • Optimizing the algorithm for small query counts q < n by adjusting the hierarchy of difference covers and query resolution.
  • Adapting the algorithm for unordered alphabets by replacing comparisons with equality checks, preserving the same asymptotic bounds.
  • Using sparse LCE queries on sampled positions to answer arbitrary LCE queries via a two-phase strategy: short queries followed by coarse queries.

Experimental results

Research questions

  • RQ1Can O(n) time be achieved for O(n) LCE queries in the comparison model for general ordered alphabets?
  • RQ2How can the LCE problem be solved efficiently when only character comparisons (not sorting) are allowed?
  • RQ3Can the algorithm be extended to work efficiently for unordered alphabets where only equality checks are available?
  • RQ4What role do difference covers and Union-Find structures play in reducing the total number of symbol comparisons?
  • RQ5Is it possible to achieve O(n log log n) time for computing all runs in a string using only O(n) symbol comparisons?

Key findings

  • A sequence of q LCE queries on a string of length n over a general ordered alphabet can be answered in O(q log log n + n log* n) total time with O(q + n) symbol comparisons.
  • The algorithm computes all runs in a string over a general ordered alphabet in O(n log log n) time, making only O(n) symbol comparisons.
  • For general unordered alphabets, the same query sequence can be processed in O(q log n + n log* n) time using O(q + n) equality tests.
  • The improvement over Kosolobov's O(n log^{2/3} n) solution is achieved through recursive short LCE queries and multi-level difference covers.
  • The use of Union-Find with path compression and union by rank ensures that the amortized cost of comparisons remains within the stated bounds.
  • The algorithm achieves a significant reduction in total time complexity while maintaining linear comparison count, advancing toward the conjectured O(n) time for LCE queries.

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.