TY - GEN
T1 - Lempel-Ziv (LZ77) Factorization in Sublinear Time
AU - Kempa, Dominik
AU - Kociumaka, Tomasz
N1 - Publisher Copyright:
© 2024 IEEE.
PY - 2024
Y1 - 2024
N2 - Lempel-Ziv (LZ77) factorization is a fundamental problem in string processing: Greedily partition a given string T from left to right into blocks (called phrases) so that each phrase is either the leftmost occurrence of a single letter or the longest prefix of the unprocessed suffix that has another occurrence earlier in the text. This simple routine has numerous applications. Most importantly, the LZ77 factorization is the central component and the computational bottleneck of most existing compression algorithms (utilized in formats like zip, pdf, and png). LZ77 is also a widely used algorithmic tool for the detection of repetitions and periodicities in strings, and the centerpiece of many powerful compressed indexes that enable computation directly over compressed data. LZ77 factorization is one of the most studied problems in string processing. In the 47 years since its inception, numerous efficient algorithms were developed for different models of computation, including parallel, GPU, external-memory, and quantum. Remarkably, however, the complexity of the most basic problem is still not settled: All existing algorithms in the RAM model run in Ω(n) time, which is a Θ(log n) factor away from the lower bound of Ω(n/log n) (following simply from the necessity to read the entire input, which takes Θ(n/log n) space for any T 0,1\n). Sublinear-time algorithms are known for nearly all other fundamental problems on strings, but LZ77 seems resistant to all currently known techniques. We present the first o(n) -time algorithm for constructing the LZ77 factorization, breaking the linear-time barrier present for nearly 50 years. More precisely, we show that, in the standard RAM model, it is possible to compute the LZ77 factorization of a given length-n string T 0,1\n in O(n/√log n)=o(n) time and using the optimal O(n/log n) working space. Our algorithm generalizes to larger alphabets Σ=[0.. Σ), where }Σ=nO2(1). The runtime and working space then become O((nlogΣ)/√{log n}) and O(n/logΣn), respectively. To achieve this sublinear-time LZ77 algorithm, we prove a more general result: We show that, for any constant ϵ(0,1) and string T\in[0..Σ)n, in {O}((nlogΣ)/√{log n}) time and using {O}(n/logΣn) working space, we can construct an index of optimal size {O}(n/logΣn) that, given any substring P=T[j.. j+ℓ) specified with a pair (j,ℓ), computes the leftmost occurrence of P in T in O(logϵn) time. In other words, we solve the indexing/online variant of the LZ77 problem, where we can efficiently query the phrase length starting at any position. Our solution is based on a new type of queries that we call prefix range minimum queries or prefix RMQ. After developing an efficient solution for these queries, we provide a general reduction showing that any new tradeoff for the prefix RMQ implies a new tradeoff for an index finding leftmost occurrences (and hence a new LZ77 factorization algorithm).
AB - Lempel-Ziv (LZ77) factorization is a fundamental problem in string processing: Greedily partition a given string T from left to right into blocks (called phrases) so that each phrase is either the leftmost occurrence of a single letter or the longest prefix of the unprocessed suffix that has another occurrence earlier in the text. This simple routine has numerous applications. Most importantly, the LZ77 factorization is the central component and the computational bottleneck of most existing compression algorithms (utilized in formats like zip, pdf, and png). LZ77 is also a widely used algorithmic tool for the detection of repetitions and periodicities in strings, and the centerpiece of many powerful compressed indexes that enable computation directly over compressed data. LZ77 factorization is one of the most studied problems in string processing. In the 47 years since its inception, numerous efficient algorithms were developed for different models of computation, including parallel, GPU, external-memory, and quantum. Remarkably, however, the complexity of the most basic problem is still not settled: All existing algorithms in the RAM model run in Ω(n) time, which is a Θ(log n) factor away from the lower bound of Ω(n/log n) (following simply from the necessity to read the entire input, which takes Θ(n/log n) space for any T 0,1\n). Sublinear-time algorithms are known for nearly all other fundamental problems on strings, but LZ77 seems resistant to all currently known techniques. We present the first o(n) -time algorithm for constructing the LZ77 factorization, breaking the linear-time barrier present for nearly 50 years. More precisely, we show that, in the standard RAM model, it is possible to compute the LZ77 factorization of a given length-n string T 0,1\n in O(n/√log n)=o(n) time and using the optimal O(n/log n) working space. Our algorithm generalizes to larger alphabets Σ=[0.. Σ), where }Σ=nO2(1). The runtime and working space then become O((nlogΣ)/√{log n}) and O(n/logΣn), respectively. To achieve this sublinear-time LZ77 algorithm, we prove a more general result: We show that, for any constant ϵ(0,1) and string T\in[0..Σ)n, in {O}((nlogΣ)/√{log n}) time and using {O}(n/logΣn) working space, we can construct an index of optimal size {O}(n/logΣn) that, given any substring P=T[j.. j+ℓ) specified with a pair (j,ℓ), computes the leftmost occurrence of P in T in O(logϵn) time. In other words, we solve the indexing/online variant of the LZ77 problem, where we can efficiently query the phrase length starting at any position. Our solution is based on a new type of queries that we call prefix range minimum queries or prefix RMQ. After developing an efficient solution for these queries, we provide a general reduction showing that any new tradeoff for the prefix RMQ implies a new tradeoff for an index finding leftmost occurrences (and hence a new LZ77 factorization algorithm).
KW - LZ77
KW - Lempel-Ziv compression
KW - Lempel-Ziv factorization
KW - data compression
KW - prefix range minimum queries
UR - https://www.scopus.com/pages/publications/85213017826
U2 - 10.1109/FOCS61266.2024.00122
DO - 10.1109/FOCS61266.2024.00122
M3 - Conference contribution
AN - SCOPUS:85213017826
T3 - Proceedings - Annual IEEE Symposium on Foundations of Computer Science, FOCS
SP - 2045
EP - 2055
BT - Proceedings - 2024 IEEE 65th Annual Symposium on Foundations of Computer Science, FOCS 2024
PB - IEEE Computer Society
T2 - 65th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2024
Y2 - 27 October 2024 through 30 October 2024
ER -