Space-efficient SLP encoding for O(log⁡N)O(\log N)-time random access

preprint2026arXivOpen access

Abstract

A Straight-Line Program (SLP) GG for a string TT is a context-free grammar (CFG) that derives TT only, which can be considered as a compressed representation of TT. In this paper, we show how to encode GG in n⌈lg⁡N⌉+(n+n′)⌈lg⁡(n+σ)⌉+4n−2n′+o(n)n \lceil \lg N \rceil + (n + n') \lceil \lg (n+σ) \rceil + 4n - 2n' + o(n) bits to support random access queries of extracting T[p..q]T[p..q] in worst-case O(log⁡N+q−p)O(\log N + q - p) time, where NN is the length of TT, σσ is the alphabet size, nn is the number of variables in GG and n′≤nn' \le n is the number of symmetric centroid paths in the DAG representation for GG. The time complexity is almost optimal because Verbin and Yu [CPM 2013] proved that O(log⁡N)O(\log N) term cannot be significantly improved in general with poly(n)\mathrm{poly}(n)-space data structures. We also present alternative encodings that achieve the same random access time with n⌈lg⁡N⌉+n⌈lg⁡(n+σ)⌉+5n+n′+o(n)n \lceil \lg N \rceil + n \lceil \lg (n+σ) \rceil + 5n + n' + o(n) or n⌈lg⁡N⌉+n⌈lg⁡(n+σ)⌉+5n−n′+σ+o(n+σ)n \lceil \lg N \rceil + n \lceil \lg (n+σ) \rceil + 5n - n' + σ+ o(n+σ) bits of space.

Explore this paper’s authors, topics and related work.

Building this map preview

BZPEER is loading the nearby papers, people, topics and institutions for this page.

Reviews 0

Write a reviewWrite

No reviews yet.

Discussion 0

Add a commentWrite

No comments yet.