Skip to main content
QUICK REVIEW

[Paper Review] Solving Classical String Problems on Compressed Texts

Yury Lifshits|ArXiv.org|Apr 13, 2006
Algorithms and Data CompressionComputer Science22 references10 citations
TL;DR

This paper presents a novel O(n²m) algorithm for fully compressed pattern matching, where both text T and pattern P are represented by straight-line programs (SLPs), enabling efficient string operations on compressed data without decompression. The method uses dynamic programming over arithmetic progressions and achieves significant speedups over prior approaches, while also providing polynomial-time solutions for computing covers, periods, and fingerprint tables on SLP-compressed texts, though Hamming distance computation is shown to be NP- and coNP-hard.

ABSTRACT

Here we study the complexity of string problems as a function of the size of a program that generates input. We consider straight-line programs (SLP), since all algorithms on SLP-generated strings could be applied to processing LZ-compressed texts. The main result is a new algorithm for pattern matching when both a text T and a pattern P are presented by SLPs (so-called fully compressed pattern matching problem). We show how to find a first occurrence, count all occurrences, check whether any given position is an occurrence or not in time O(n^2m). Here m,n are the sizes of straight-line programs generating correspondingly P and T. Then we present polynomial algorithms for computing fingerprint table and compressed representation of all covers (for the first time) and for finding periods of a given compressed string (our algorithm is faster than previously known). On the other hand, we show that computing the Hamming distance between two SLP-generated strings is NP- and coNP-hard.

Motivation & Objective

  • To determine whether classical string problems can be solved efficiently on compressed texts represented by straight-line programs (SLPs), avoiding full decompression.
  • To address the fully compressed pattern matching (FCPM) problem: finding pattern occurrences in SLP-compressed texts.
  • To extend the FCPM algorithm to solve additional string problems such as computing all covers, periods, and fingerprint tables on compressed strings.
  • To establish complexity boundaries by proving that Hamming distance computation on SLP-generated strings is NP- and coNP-hard.
  • To explore the feasibility of polynomial-time algorithms for various string problems on compressed inputs, distinguishing tractable from intractable cases.

Proposed method

  • The core technique uses dynamic programming over an n×m table, where n and m are the sizes of SLPs generating the text T and pattern P, respectively.
  • Each entry in the table tracks potential matches using arithmetic progressions to represent positions of pattern occurrences in the compressed text.
  • A novel local pattern matching (Local PM) procedure checks for valid pattern occurrences by comparing prefixes and suffixes of substrings, reducing false positives.
  • The algorithm leverages properties of SLPs to compute intermediate string values and their structural features (e.g., borders, covers) without decompressing the full string.
  • For fingerprint table computation, the method recursively computes prefix, suffix, and 'cut-containing' substring fingerprints using induction on SLP structure.
  • Hardness results are established via a reduction from the Subset Sum problem, constructing SLPs for strings P and T such that HD(P,T) < h iff a solution exists.

Experimental results

Research questions

  • RQ1Can the fully compressed pattern matching problem be solved in time polynomial in the size of the SLPs, without decompressing the strings?
  • RQ2Is it possible to compute all covers and periods of a compressed string in polynomial time using SLP representations?
  • RQ3Can a fingerprint table for all substrings of a compressed string be computed efficiently, with bounded output size?
  • RQ4What is the computational complexity of computing the Hamming distance between two SLP-generated strings?
  • RQ5Are there more efficient algorithms than the current O(n²m) for fully compressed pattern matching, or is this the best possible?

Key findings

  • The paper presents an O(n²m) algorithm for fully compressed pattern matching, where n and m are the sizes of the SLPs generating the text and pattern, respectively, significantly improving over prior O(n²m²) and O((n+m)⁵log³|T|) methods.
  • The algorithm uses dynamic programming with arithmetic progressions and a novel Local PM procedure to efficiently validate pattern occurrences, reducing per-entry computation to O(n) time.
  • Polynomial-time algorithms are developed for computing all covers and periods of a compressed string, with time complexity O(n³log²|T|).
  • A fingerprint table for all substrings of a compressed string can be computed in O(n|Σ|²log n) time with O(n|Σ|²) output size.
  • The Hamming distance problem between two SLP-generated strings is proven to be NP- and coNP-hard, establishing a sharp complexity boundary between tractable and intractable problems on compressed strings.
  • The results imply that the proposed FCPM algorithm can be directly applied to LZ-compressed texts via SLP translation, maintaining the same time complexity.

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.