Faster Pattern Matching under Edit Distance : A Reduction to Dynamic Puzzle Matching and the Seaweed Monoid of Permutation Matrices
Panagiotis Charalampopoulos, Tomasz Kociumaka, Philip Wellnitz
Abstract
We consider the approximate pattern matching problem under the edit distance. Given a text T of length n, a pattern P of length m, and a threshold k, the task is to find the starting positions of all substrings of T that can be transformed to P with at most k edits. More than 20 years ago, Cole and Hariharan [SODA’98, J. Comput.’02] gave an time algorithm for this classic problem, and this runtime has not been improved since.Here, we present an algorithm that runs in time , thus breaking through this longstanding barrier. In the case where for some arbitrarily small positive constant , our algorithm improves over the state-of-the-art by polynomial factors: it is polynomially faster than both the algorithm of Cole and Hariharan and the classic -time algorithm of Landau and Vishkin [STOC’86, J. Algorithms’89].We observe that the bottleneck case of the alternative -time algorithm of Charalampopoulos, Kociumaka, and Wellnitz [FOCS’20] is when the text and the pattern are (almost) periodic. Our new algorithm reduces this case to a new Dynamic Puzzle Matching problem, which we solve by building on tools developed by Tiskin [SODA’10, Algorithmica’15] for the so-called seaweed monoid of permutation matrices. Our algorithm relies only on a small set of primitive operations on strings and thus also applies to the fully-compressed setting (where text and pattern are given as straight-line programs) and to the dynamic setting (where we maintain a collection of strings under creation, splitting, and concatenation), improving over the state of the art.
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.
6 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Pattern Matching under Weighted Edit Distance cites Faster Approximate Pattern Matching: A Unified Approach
- Pattern Matching under Weighted Edit Distance cites Bounded Edit Distance: Optimal Static and Dynamic Algorithms for Small Integer Weights
- Pattern Matching under Weighted Edit Distance cites On the Communication Complexity of Approximate Pattern Matching
- Pattern Matching under Weighted Edit Distance cites Near-Optimal-Time Quantum Algorithms for Approximate Pattern Matching
- Faster Approximate Pattern Matching: A Unified Approach cites Approximating text-to-pattern Hamming distances
- Bounded Edit Distance: Optimal Static and Dynamic Algorithms for Small Integer Weights cites Faster Approximate Pattern Matching: A Unified Approach
- On the Communication Complexity of Approximate Pattern Matching cites Faster Approximate Pattern Matching: A Unified Approach
- On the Communication Complexity of Approximate Pattern Matching cites Small-space and streaming pattern matching with k edits
- Small-space and streaming pattern matching with k edits cites Faster Approximate Pattern Matching: A Unified Approach
- Small-space and streaming pattern matching with k edits cites Approximating text-to-pattern Hamming distances
- Lempel-Ziv (LZ77) Factorization in Sublinear Time cites Faster Approximate Pattern Matching: A Unified Approach
- Near-Optimal-Time Quantum Algorithms for Approximate Pattern Matching cites Faster Approximate Pattern Matching: A Unified Approach
- Near-Optimal-Time Quantum Algorithms for Approximate Pattern Matching cites On the Communication Complexity of Approximate Pattern Matching
- Near-Optimal-Time Quantum Algorithms for Approximate Pattern Matching cites Small-space and streaming pattern matching with k edits
Cited by top-tier papers6
- Pattern Matching under Weighted Edit DistancePanagiotis Charalampopoulos, Tomasz Kociumaka, Philip WellnitzFOCS 2025 · 3 citations
- On the Communication Complexity of Approximate Pattern MatchingTomasz Kociumaka, Jakob Nogler, Philip WellnitzSTOC 2024 · 2 citations
- Lempel-Ziv (LZ77) Factorization in Sublinear TimeDominik Kempa, Tomasz KociumakaFOCS 2024 · 2 citations
- Bounded Edit Distance: Optimal Static and Dynamic Algorithms for Small Integer WeightsEgor Gorbachev, Tomasz KociumakaSTOC 2025 · 1 citation
- Near-Optimal-Time Quantum Algorithms for Approximate Pattern MatchingTomasz Kociumaka, Jakob Nogler, Philip WellnitzSODA 2025 · 1 citation
Builds on3
- Small-space and streaming pattern matching with editsTomasz Kociumaka, Ely Porat, Tatiana StarikovskayaFOCS 2021 · 13 citations
- Faster Approximate Pattern Matching: A Unified ApproachPanagiotis Charalampopoulos, Tomasz Kociumaka, Philip WellnitzFOCS 2020 · 2 citations
- Approximating text-to-pattern Hamming distancesTimothy M. Chan, Shay Golan, Tomasz Kociumaka, Tsvi Kopelowitz et al.STOC 2020 · 2 citations
Related papers
- Optimal Algorithms for Bounded Weighted Edit DistanceAlejandro Cassis, Tomasz Kociumaka, Philip WellnitzFOCS 2023 · 4 citations
- Near-Optimal Property Testers for Pattern MatchingCe Jin, Tomasz KociumakaFOCS 2025 · 1 citation
- Sublinear-Time Algorithms for Computing & Embedding Gap Edit DistanceTomasz Kociumaka, Barna SahaFOCS 2020 · 9 citations
- Faster Sublinear-Time Edit DistanceKarl Bringmann, Alejandro Cassis, Nick Fischer, Tomasz KociumakaSODA 2024 · 3 citations
- Faster Algorithms for Text-to-Pattern Hamming DistancesTimothy M. Chan, Ce Jin, Virginia Vassilevska Williams, Yinzhan XuFOCS 2023 · 3 citations
