Near-Optimal Property Testers for Pattern Matching
Ce Jin, Tomasz Kociumaka
Abstract
The classic exact pattern matching problem, given two strings——a pattern P of length m and a text T of length n—— asks whether P occurs as a substring of T, that is, holds for some . A property tester for the problem needs to distinguish (with high probability) the following two cases for some threshold : the Yes case, where P occurs as a substring of T, and the No case, where has Hamming distance greater than k from every substring of T, that is, P has no k-mismatch occurrence in T. In this work, we provide adaptive and non-adaptive property testers for the exact pattern matching problem, jointly covering the whole spectrum of parameters. We further establish unconditional lower bounds demonstrating that the time and query complexities of our algorithms are optimal, up to polylog n factors hidden within the notation below. In the most studied regime of , our nonadaptive property tester has the time complexity of , and a matching lower bound remains valid for the query complexity of adaptive algorithms. This improves both upon a folklore solution that attains the optimal query complexity but requires time, and upon the only previously known sublineartime property tester, by Chan, Golan, Kociumaka, Kopelowitz, and Porat [STOC 2020], with time complexity . The aforementioned results remain valid for , where our optimal running time improves upon the previously best time complexity of . In the regime of , which has not been targeted in any previous work, we establish a surprising separation between adaptive and non-adaptive algorithms, whose optimal time and query complexities are and , respectively. Our non-adaptive algorithms answer Yes with high probability not only when P has an exact occurrence in T but also when P has an occurrence with at most mismatches. The gap can be reduced by slightly increasing the running time; an arbitrarily small polynomial overhead already suffices to achieve a constant gap. Moreover, upon request, our algorithms may output a set that contains the starting positions of all -mismatch occurrences of in and no starting position of an occurrence with more than k mismatches. The key technical innovation behind all our property testers is a novel characterization of the mismatches between the pattern P and the fragments across . We show that one can select positions within P and T so that, for every , at least of the mismatches between P and involve a selected position. Previously, such a construction was known for k
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext d76c0384-2457-4417-a00a-1f5022cdbb09Builds on2
Related papers
- Faster Approximate Pattern Matching: A Unified ApproachPanagiotis Charalampopoulos, Tomasz Kociumaka, Philip WellnitzFOCS 2020 · 2 citations
- Near-Optimal-Time Quantum Algorithms for Approximate Pattern MatchingTomasz Kociumaka, Jakob Nogler, Philip WellnitzSODA 2025 · 1 citation
- Faster two-dimensional pattern matching with k mismatchesJonas Ellert, Pawel Gawrychowski, Adam Górkiewicz, Tatiana StarikovskayaSODA 2025 · 1 citation
- On the Communication Complexity of Approximate Pattern MatchingTomasz Kociumaka, Jakob Nogler, Philip WellnitzSTOC 2024 · 2 citations
- 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
