English

Lempel-Ziv (LZ77) Factorization in Sublinear Time

Data Structures and Algorithms 2025-06-19 v1

Abstract

Lempel-Ziv (LZ77) factorization is a fundamental problem in string processing: Greedily partition a given string TT from left to right into blocks (called phrases) so that each phrase is either the leftmost occurrence of a letter or the longest prefix of the unprocessed suffix that has another occurrence earlier in TT. Due to numerous applications, LZ77 factorization is one of the most studied problems on strings. In the 47 years since its inception, several algorithms were developed for different models of computation, including parallel, GPU, external-memory, and quantum. Remarkably, however, the complexity of the most basic variant is still not settled: All existing algorithms in the RAM model run in Ω(n)\Omega(n) time, which is a Θ(logn)\Theta(\log n) factor away from the lower bound of Ω(n/logn)\Omega(n/\log n) (following from the necessity to read the input, which takes Θ(n/logn)\Theta(n/\log n) space for T{0,1}nT\in\{0,1\}^{n}). We present the first o(n)o(n)-time algorithm for LZ77 factorization, breaking the linear-time barrier present for nearly 50 years. For T{0,1}nT\in\{0,1\}^{n}, our algorithm runs in O(n/logn)=o(n)\mathcal{O}(n/\sqrt{\log n})=o(n) time and uses the optimal O(n/logn)\mathcal{O}(n/\log n) working space. Our algorithm generalizes to Σ=[0..σ)\Sigma=[0..\sigma), where σ=nO(1)\sigma=n^{\mathcal{O}(1)}. The runtime and working space then become O((nlogσ)/logn)\mathcal{O}((n\log\sigma)/\sqrt{\log n}) and O(n/logσn)\mathcal{O}(n/\log_{\sigma} n). To obtain our algorithm, we prove a more general result: For any constant ϵ(0,1)\epsilon\in(0,1) and T[0..σ)nT\in[0..\sigma)^{n}, in O((nlogσ)/logn)\mathcal{O}((n\log\sigma)/\sqrt{\log n}) time and using O(n/logσn)\mathcal{O}(n/\log_{\sigma}n) space, we can construct an O(n/logσn)\mathcal{O}(n/\log_{\sigma}n)-size index that, given any P=T[j..j+)P=T[j..j+\ell) (represented as (j,)(j,\ell)), computes the leftmost occurrence of PP in TT in O(logϵn)\mathcal{O}(\log^{\epsilon}n) time. In other words, we solve the indexing/online variant of the LZ77 problem.

Keywords

Cite

@article{arxiv.2409.12146,
  title  = {Lempel-Ziv (LZ77) Factorization in Sublinear Time},
  author = {Dominik Kempa and Tomasz Kociumaka},
  journal= {arXiv preprint arXiv:2409.12146},
  year   = {2025}
}

Comments

Accepted to FOCS 2024

R2 v1 2026-06-28T18:49:17.661Z