Skip to main content
QUICK REVIEW

[Paper Review] Tying up the loose ends in fully LZW-compressed pattern matching

Paweł Gawrychowski|arXiv (Cornell University)|Sep 19, 2011
Algorithms and Data CompressionComputer Science19 citations
TL;DR

This paper presents the first optimal linear-time algorithm for fully LZW-compressed pattern matching, where both pattern and text are compressed using the Lempel-Ziv-Welch (LZW) method. By leveraging block covers, iterative compression, and a novel use of the PREF function with suffix trees on the codeword trie, the method achieves O(n + m) time complexity, significantly improving upon the prior O((n + m) log(n + m)) solution and closing a long-standing open problem in compressed pattern matching.

ABSTRACT

We consider a natural generalization of the classical pattern matching problem: given compressed representations of a pattern p[1..M] and a text t[1..N] of sizes m and n, respectively, does p occur in t? We develop an optimal linear time solution for the case when both p and t are compressed using the LZW method. This improves the previously known O((n+m)log(n+m)) time solution of Gasieniec and Rytter, and essentially closes the line of research devoted to studying LZW-compressed exact pattern matching.

Motivation & Objective

  • To solve the fully compressed pattern matching problem for LZW-compressed strings in optimal linear time.
  • To close the gap between the previously known O((n + m) log(n + m)) solution and the theoretical lower bound of O(n + m).
  • To develop a method that avoids decompressing the pattern or text while efficiently detecting pattern occurrences in compressed form.
  • To extend the O(n + M) linear-time algorithm for compressed pattern matching (from prior work) to the fully compressed case, where both pattern and text are compressed.

Proposed method

  • The algorithm uses a block cover data structure to represent fragments of the pattern as prefixes of LZW codewords, enabling efficient manipulation without full decompression.
  • It applies iterative compression by merging adjacent blocks in the pattern representation whenever they appear as prefixes in a longer codeword, reducing structural complexity.
  • The method employs the PREF function to compute longest common prefixes between pattern fragments and text fragments in compressed form, using a level ancestor data structure for constant-time access.
  • A suffix tree is built on the LZW codeword trie to enable constant-time longest common prefix queries between any two codewords, using lowest common ancestor (LCA) queries.
  • The algorithm dynamically maintains a pointer to the current block covering the pattern position, updating it in constant time during scanning to support efficient pattern matching.
  • For periodic patterns, a modified version of the prior O(n + M) algorithm is used, with additional techniques to handle the compressed structure without decompression.

Experimental results

Research questions

  • RQ1Can fully LZW-compressed pattern matching be solved in linear time, i.e., O(n + m), where n and m are the compressed sizes of the text and pattern?
  • RQ2Is it possible to avoid decompressing the pattern and text while still detecting pattern occurrences in compressed form?
  • RQ3What structural properties of LZW-compressed strings can be exploited to achieve optimal time complexity in pattern matching?
  • RQ4How can the PREF function be adapted to work efficiently on compressed pattern fragments represented as block covers?
  • RQ5Can the O((n + m) log(n + m)) solution by Gąsieniec and Rytter be improved to optimal O(n + m) time using novel data structures and compression techniques?

Key findings

  • The paper presents the first optimal O(n + m) time algorithm for fully LZW-compressed pattern matching, where n and m are the compressed sizes of the text and pattern.
  • The algorithm uses a block cover representation to maintain pattern fragments as prefixes of LZW codewords, enabling efficient and compressed pattern matching.
  • By building a suffix tree on the codeword trie, the method supports constant-time longest common prefix queries between any two codewords, which is crucial for the linear-time performance.
  • The use of the PREF function with iterative compression allows the algorithm to verify potential matches across the entire pattern in a single pass.
  • For periodic patterns, a modified version of the O(n + M) algorithm from prior work is applied, with adjustments to maintain linear time in the compressed size.
  • The solution is optimal and closes the long-standing open problem of achieving linear-time fully compressed pattern matching under LZW compression.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.