Skip to main content
QUICK REVIEW

[Paper Review] Optimal trade-offs for pattern matching with $k$ mismatches

Paweł Gawrychowski, Przemysław Uznański|arXiv (Cornell University)|Apr 5, 2017
Algorithms and Data CompressionComputer Science5 citations
TL;DR

This paper presents a new algorithm for $k$-mismatch pattern matching that achieves a smooth time trade-off of $\widetilde{\mathcal{O}}((m + k\sqrt{m}) \cdot n/m)$, interpolating between the $\widetilde{\mathcal{O}}(n\sqrt{k})$ and $\widetilde{\mathcal{O}}((m + k^2) \cdot n/m)$ bounds. It is complemented by a conditional lower bound showing that significantly faster combinatorial algorithms are unlikely, assuming the combinatorial matrix multiplication conjecture.

ABSTRACT

Given a pattern of length $m$ and a text of length $n$, the goal in $k$-mismatch pattern matching is to compute, for every $m$-substring of the text, the exact Hamming distance to the pattern or report that it exceeds $k$. This can be solved in either $\widetilde{O}(n \sqrt{k})$ time as shown by Amir et al. [J. Algorithms 2004] or $\widetilde{O}((m + k^2) \cdot n/m)$ time due to a result of Clifford et al. [SODA 2016]. We provide a smooth time trade-off between these two bounds by designing an algorithm working in time $\widetilde{O}( (m + k \sqrt{m}) \cdot n/m)$. We complement this with a matching conditional lower bound, showing that a significantly faster combinatorial algorithm is not possible, unless the combinatorial matrix multiplication conjecture fails.

Motivation & Objective

  • To close the gap between two known time bounds for $k$-mismatch pattern matching: $\widetilde{\mathcal{O}}(n\sqrt{k})$ and $\widetilde{\mathcal{O}}((m + k^2) \cdot n/m)$.
  • To design a single algorithm that smoothly interpolates between these extremes, offering better performance across the full range of $k$ values.
  • To provide a conditional lower bound showing that the proposed trade-off is nearly optimal under the combinatorial matrix multiplication conjecture.
  • To unify and improve upon prior techniques, including convolution, RLE compression, and block-based decomposition, for efficient $k$-mismatch computation.

Proposed method

  • The algorithm partitions the pattern and text into $\mathcal{O}(k)$ blocks using run-length encoding (RLE), reducing the problem to RLE $k$-mismatch pattern matching.
  • For letters appearing in few RLE blocks, it computes matches in constant time per block pair using precomputed representations.
  • For letters appearing in many blocks, it uncompresses the corresponding pattern fragments and applies classical FFT-based convolution in $\mathcal{O}(m)$ time.
  • It sets a threshold to balance the cost between the two approaches, achieving $\widetilde{\mathcal{O}}(k\sqrt{m})$ time for the RLE subproblem.
  • The overall time complexity is $\widetilde{\mathcal{O}}((m + k\sqrt{m}) \cdot n/m)$ by combining the two strategies and leveraging generating functions and second derivatives for efficient updates.
  • A conditional lower bound is derived by reducing from rectangular boolean matrix multiplication, showing that faster combinatorial algorithms would contradict the combinatorial matrix multiplication conjecture.

Experimental results

Research questions

  • RQ1Can a smooth time trade-off be achieved between the $\widetilde{\mathcal{O}}(n\sqrt{k})$ and $\widetilde{\mathcal{O}}((m + k^2) \cdot n/m)$ bounds for $k$-mismatch pattern matching?
  • RQ2Is the proposed trade-off of $\widetilde{\mathcal{O}}((m + k\sqrt{m}) \cdot n/m)$ time optimal, or can it be significantly improved?
  • RQ3Can the conditional lower bound based on combinatorial matrix multiplication be extended to rule out faster combinatorial algorithms for this problem?
  • RQ4How can RLE compression and convolution be combined effectively to handle both sparse and dense letter occurrences in the pattern?

Key findings

  • The proposed algorithm achieves a time complexity of $\widetilde{\mathcal{O}}((m + k\sqrt{m}) \cdot n/m)$, which matches the best-known bounds at the extremes $k = \mathcal{O}(\sqrt{m})$ and $k = \Omega(m)$, but improves the trade-off in between.
  • For $k = \Theta(m^{2/3})$, the algorithm improves the complexity from $\widetilde{\mathcal{O}}(m^{4/3})$ to $\widetilde{\mathcal{O}}(m^{7/6})$, demonstrating a significant improvement in the intermediate regime.
  • The algorithm is conditionally optimal: a significantly faster combinatorial algorithm would contradict the combinatorial matrix multiplication conjecture.
  • The conditional lower bound holds for $k = \Theta(n^\kappa)$ and pattern length $m = \Theta(n^\alpha)$ with $\frac{1}{2}\alpha \leq \kappa \leq \alpha \leq 1$, under the conjecture.
  • The method effectively combines RLE-based block decomposition with FFT-based convolution, using a thresholding strategy to balance the cost of processing rare and frequent letters.
  • The use of second derivatives of generating functions allows for $\mathcal{O}(k \cdot t)$ time maintenance of the mismatch count, where $t = \sqrt{m \log m}$, leading to the final time bound.

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.