English

String Indexing for Top-$k$ Close Consecutive Occurrences

Data Structures and Algorithms 2024-02-15 v3

Abstract

The classic string indexing problem is to preprocess a string SS into a compact data structure that supports efficient subsequent pattern matching queries, that is, given a pattern string PP, report all occurrences of PP within SS. In this paper, we study a basic and natural extension of string indexing called the string indexing for top-kk close consecutive occurrences problem (SITCCO). Here, a consecutive occurrence is a pair (i,j)(i,j), i<ji < j, such that PP occurs at positions ii and jj in SS and there is no occurrence of PP between ii and jj, and their distance is defined as jij-i. Given a pattern PP and a parameter kk, the goal is to report the top-kk consecutive occurrences of PP in SS of minimal distance. The challenge is to compactly represent SS while supporting queries in time close to the length of PP and kk. We give three time-space trade-offs for the problem. Let nn be the length of SS, mm the length of PP, and ϵ(0,1]\epsilon\in(0,1]. Our first result achieves O(nlogn)O(n\log n) space and optimal query time of O(m+k)O(m+k). Our second and third results achieve linear space and query times either O(m+k1+ϵ)O(m+k^{1+\epsilon}) or O(m+klog1+ϵn)O(m + k \log^{1+\epsilon} n). Along the way, we develop several techniques of independent interest, including a new translation of the problem into a line segment intersection problem and a new recursive clustering technique for trees.

Keywords

Cite

@article{arxiv.2007.04128,
  title  = {String Indexing for Top-$k$ Close Consecutive Occurrences},
  author = {Philip Bille and Inge Li Gørtz and Max Rishøj Pedersen and Eva Rotenberg and Teresa Anna Steiner},
  journal= {arXiv preprint arXiv:2007.04128},
  year   = {2024}
}

Comments

Updated to accepted journal version

R2 v1 2026-06-23T16:57:07.427Z