中文

Optimal-Time Contextual Pattern Matching in Compressed Space

数据结构与算法 2026-06-30 v1

摘要

Contextual pattern matching is the task of, given a pattern P[1,m]P[1,m], a context length λ\lambda, and a text T[1,n]T[1,n], find all the occocc distinct contexts in which PP occurs in TT, the context being the λ\lambda symbols preceding and the λ\lambda symbols following the occurrence; a text position where each context occurs must be output. While the problem can be solved in optimal time O(m+occ)O(m+occ) using O(n)O(n)-space precomputed data structures on TT, this type of search is particularly relevant on large repetitive text collections, where O(n)O(n) space can be prohibitive. We present the first optimal-time solution that runs in compressed space, namely that of a symmetric CDAWG (SCDAWG) of TT. Further, we show how the set of occocc solutions can be enumerated with O(loglogλ)O(\log\log\lambda) delay after O(m)O(m)-time preprocessing of PP. To achieve this, we develop an improved linear-space distance-sensitive weighted ancestor data structure.

引用

@article{arxiv.2606.31030,
  title  = {Optimal-Time Contextual Pattern Matching in Compressed Space},
  author = {Gonzalo Navarro and Francisco Olivares},
  journal= {arXiv preprint arXiv:2606.31030},
  year   = {2026}
}