Lune

FOCS2021Top-tier venue

Small-space and streaming pattern matching with kk edits

Tomasz Kociumaka, Ely Porat, Tatiana Starikovskaya

Abstract

In this work, we revisit the fundamental and well-studied problem of approximate pattern matching under edit distance. Given an integerkk, a patternPPof lengthmm, and a textTTof lengthn≥mn\geq m, the task is to find substrings ofTTthat are within edit distancekkfromPP. Our main result is a streaming algorithm that solves the problem inO~(k5)\tilde{\mathcal{O}}(k^{5})space11Hereafter,O~(⋅)\tilde{\mathcal{O}}(\cdot)hides apoly(log⁡n)\text{poly} (\log n)factor. andO~(k8)\tilde{\mathcal{O}}(k^{8})amortized time per character of the text, providing answers correct with high probability. This answers a decade-old question: since the discovery of a poly (k log nk\ \text{log}\ n) -space streaming algorithm for pattern matching under Hamming distance by Porat and Porat [FOCS 2009], the existence of an analogous result for edit distance remained open. Up to this work, no poly (k log nk\ \text{log}\ n)-space algorithm was known even in the simpler semi-streaming model, whereTTcomes as a stream butPPis available for read-only access. In this model, we give a deterministic algorithm that achieves slightly better complexity. Our central technical contribution is a new space-efficient deterministic encoding of two strings, called the greedy encoding, which encodes a set of all alignments of cost at mostkkwith a certain property (we call such alignments greedy). On strings of length at mostnn, the encoding occupiesO~(k2)\tilde{\mathcal{O}}(k^{2})space. We use the encoding to compress substrings of the text that are close to the pattern. In order to do so, we compute the encoding for substrings of the text and of the pattern, which requires read-only access to the latter. In order to develop the fully streaming algorithm, we further introduce a new edit distance sketch parameterized by integersn>kn > k. For any string of length at mostnn, the sketch is of sizeO~(k‾2)\tilde{\mathcal{O}}\overline{(k}^{2}), and it can be computed with anO~(k2)\tilde{\mathcal{O}}(k^{2})-space streaming algorithm. Given the sketches of two strings, inO~(k3)\tilde{\mathcal{O}}(k^{3})time we can compute their edit distance or certify that it is larger thankk. This result improves uponO~(k8)\tilde{\mathcal{O}}(k^{8})-size sketches of Belazzougui and Zhang [FOCS 2016] and very recentO~(k3)\tilde{\mathcal{O}}(k^{3})-size sketches of Jin, Nelson, and Wu [STACS 2021].

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

10 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Faster Approximate Pattern Matching: A Unified Approach cites Approximating text-to-pattern Hamming distances
  • Faster Approximate Pattern Matching: A Unified Approach cites Resolution of the Burrows-Wheeler Transform Conjecture
  • Near-Optimal Quantum Algorithms for Bounded Edit Distance and Lempel-Ziv Factorization cites Resolution of the Burrows-Wheeler Transform Conjecture
  • Faster Pattern Matching under Edit Distance : A Reduction to Dynamic Puzzle Matching and the Seaweed Monoid of Permutation Matrices cites Faster Approximate Pattern Matching: A Unified Approach
  • Faster Pattern Matching under Edit Distance : A Reduction to Dynamic Puzzle Matching and the Seaweed Monoid of Permutation Matrices cites Approximating text-to-pattern Hamming distances
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers10

  1. Faster Pattern Matching under Edit Distance : A Reduction to Dynamic Puzzle Matching and the Seaweed Monoid of Permutation MatricesPanagiotis Charalampopoulos, Tomasz Kociumaka, Philip WellnitzFOCS 2022 · 8 citations
  2. Near-Optimal Quantum Algorithms for Bounded Edit Distance and Lempel-Ziv FactorizationDaniel Gibney, Ce Jin, Tomasz Kociumaka, Sharma V. ThankachanSODA 2024 · 7 citations
  3. Õ(n+poly(k))-time Algorithm for Bounded Tree Edit DistanceDebarati Das, Jacob Gilbert, MohammadTaghi Hajiaghayi, Tomasz Kociumaka et al.FOCS 2022 · 5 citations
  4. Streaming Regular Expression Membership and Pattern MatchingBartlomiej Dudek, Pawel Gawrychowski, Garance Gourdel, Tatiana StarikovskayaSODA 2022 · 4 citations
  5. Approximation Schemes for Edit Distance and LCS in Quasi-Strongly Subquadratic TimeXiao Mao, Aviad RubinsteinSTOC 2026 · 4 citations

Builds on3

  1. Resolution of the Burrows-Wheeler Transform ConjectureDominik Kempa, Tomasz KociumakaFOCS 2020 · 32 citations
  2. Faster Approximate Pattern Matching: A Unified ApproachPanagiotis Charalampopoulos, Tomasz Kociumaka, Philip WellnitzFOCS 2020 · 2 citations
  3. Approximating text-to-pattern Hamming distancesTimothy M. Chan, Shay Golan, Tomasz Kociumaka, Tsvi Kopelowitz et al.STOC 2020 · 2 citations

Related papers

  1. Sublinear-Time Algorithms for Computing & Embedding Gap Edit DistanceTomasz Kociumaka, Barna SahaFOCS 2020 · 9 citations
  2. Almost Linear Size Edit Distance SketchMichal Koucký, Michael E. SaksSTOC 2024 · 1 citation
  3. Near-Optimal-Time Quantum Algorithms for Approximate Pattern MatchingTomasz Kociumaka, Jakob Nogler, Philip WellnitzSODA 2025 · 1 citation
  4. Almost-optimal sublinear-time edit distance in the low distance regimeKarl Bringmann, Alejandro Cassis, Nick Fischer, Vasileios NakosSTOC 2022 · 4 citations
  5. Optimal Algorithms for Bounded Weighted Edit DistanceAlejandro Cassis, Tomasz Kociumaka, Philip WellnitzFOCS 2023 · 4 citations
Dusk over the sea between two cliffs drawn in fine vertical lines