English

Decompressing Lempel-Ziv Compressed Text

Data Structures and Algorithms 2019-11-05 v2

Abstract

We consider the problem of decompressing the Lempel--Ziv 77 representation of a string SS of length nn using a working space as close as possible to the size zz of the input. The folklore solution for the problem runs in O(n)O(n) time but requires random access to the whole decompressed text. Another folklore solution is to convert LZ77 into a grammar of size O(zlog(n/z))O(z\log(n/z)) and then stream SS in linear time. In this paper, we show that O(n)O(n) time and O(z)O(z) working space can be achieved for constant-size alphabets. On general alphabets of size σ\sigma, we describe (i) a trade-off achieving O(nlogδσ)O(n\log^\delta \sigma) time and O(zlog1δσ)O(z\log^{1-\delta}\sigma) space for any 0δ10\leq \delta\leq 1, and (ii) a solution achieving O(n)O(n) time and O(zloglog(n/z))O(z\log\log (n/z)) space. The latter solution, in particular, dominates both folklore algorithms for the problem. Our solutions can, more generally, extract any specified subsequence of SS with little overheads on top of the linear running time and working space. As an immediate corollary, we show that our techniques yield improved results for pattern matching problems on LZ77-compressed text.

Keywords

Cite

@article{arxiv.1802.10347,
  title  = {Decompressing Lempel-Ziv Compressed Text},
  author = {Philip Bille and Mikko Berggren Ettienne and Travis Gagie and Inge Li Gørtz and Nicola Prezza},
  journal= {arXiv preprint arXiv:1802.10347},
  year   = {2019}
}
R2 v1 2026-06-23T00:36:30.972Z