English

Improved Grammar-Based Compressed Indexes

Data Structures and Algorithms 2011-10-21 v1

Abstract

We introduce the first grammar-compressed representation of a sequence that supports searches in time that depends only logarithmically on the size of the grammar. Given a text T[1..u]T[1..u] that is represented by a (context-free) grammar of nn (terminal and nonterminal) symbols and size NN (measured as the sum of the lengths of the right hands of the rules), a basic grammar-based representation of TT takes NlgnN\lg n bits of space. Our representation requires 2Nlgn+Nlgu+ϵnlgn+o(Nlgn)2N\lg n + N\lg u + \epsilon\, n\lg n + o(N\lg n) bits of space, for any 0<ϵ10<\epsilon \le 1. It can find the positions of the occocc occurrences of a pattern of length mm in TT in O((m2/ϵ)lg(lgulgn)+occlgn)O((m^2/\epsilon)\lg (\frac{\lg u}{\lg n}) +occ\lg n) time, and extract any substring of length \ell of TT in time O(+hlg(N/h))O(\ell+h\lg(N/h)), where hh is the height of the grammar tree.

Keywords

Cite

@article{arxiv.1110.4493,
  title  = {Improved Grammar-Based Compressed Indexes},
  author = {Francisco Claude and Gonzalo Navarro},
  journal= {arXiv preprint arXiv:1110.4493},
  year   = {2011}
}
R2 v1 2026-06-21T19:23:12.337Z