English

Faster Longest Common Extension Queries in Strings over General Alphabets

Data Structures and Algorithms 2016-04-08 v2

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 qq LCE queries for a string of size nn over a general ordered alphabet can be realized in O(qloglogn+nlogn)O(q \log \log n+n\log^*n) time making only O(q+n)O(q+n) symbol comparisons. Consequently, all runs in a string over a general ordered alphabet can be computed in O(nloglogn)O(n \log \log n) time making O(n)O(n) symbol comparisons. Our results improve upon a solution by Kosolobov (Information Processing Letters, 2016), who gave an algorithm with O(nlog2/3n)O(n \log^{2/3} n) running time and conjectured that O(n)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(qlogn+nlogn)O(q\log n + n\log^*n). The main tools are difference covers and the disjoint-sets data structure.

Keywords

Cite

@article{arxiv.1602.00447,
  title  = {Faster Longest Common Extension Queries in Strings over General Alphabets},
  author = {Paweł Gawrychowski and Tomasz Kociumaka and Wojciech Rytter and Tomasz Waleń},
  journal= {arXiv preprint arXiv:1602.00447},
  year   = {2016}
}

Comments

Accepted to CPM 2016

R2 v1 2026-06-22T12:40:43.472Z