English

Near-Optimal Property Testers for Pattern Matching

Data Structures and Algorithms 2025-10-21 v1

Abstract

The classic exact pattern matching problem, given two strings -- a pattern PP of length mm and a text TT of length nn -- asks whether PP occurs as a substring of TT. A property tester for the problem needs to distinguish (with high probability) the following two cases for some threshold kk: the YES case, where PP occurs as a substring of TT, and the NO case, where PP has Hamming distance greater than kk from every substring of TT, that is, PP has no kk-mismatch occurrence in TT. 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 polylogn\mathrm{polylog}\, n factors hidden within the O~()\tilde O(\cdot) notation below. In the most studied regime of n=m+Θ(m)n=m+\Theta(m), our non-adaptive property tester has the time complexity of O~(n/k)\tilde O(n/\sqrt{k}), 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 Ω(n)\Omega(n) time, and upon the only previously known sublinear-time property tester, by Chan, Golan, Kociumaka, Kopelowitz, and Porat [STOC 2020], with time complexity O~(n/k3)\tilde O(n/\sqrt[3]{k}). The aforementioned results remain valid for n=m+Ω(m)n=m+\Omega(m), where our optimal running time O~(nm/k+n/k)\tilde O(\sqrt{nm/k}+n/k) improves upon the previously best time complexity of O~(n2m/k3+n/k)\tilde O(\sqrt[3]{n^2m/k}+n/k). In the regime of n=m+o(m)n=m+o(m), 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 O~((nm+1)m/k+n/k)\tilde O(\sqrt{(n-m+1)m/k}+n/k) and O~(min(nnm+1/k,nm/k+n/k))\tilde O(\min(n\sqrt{n-m+1}/k,\sqrt{nm/k}+n/k)), respectively.

Keywords

Cite

@article{arxiv.2510.17645,
  title  = {Near-Optimal Property Testers for Pattern Matching},
  author = {Ce Jin and Tomasz Kociumaka},
  journal= {arXiv preprint arXiv:2510.17645},
  year   = {2025}
}

Comments

To appear at FOCS 2025. Abstract shortened to meet arXiv requirements

R2 v1 2026-07-01T06:47:51.185Z