,
Panagiotis Charalampopoulos
,
Taha El Ghazi
,
Jonas Ellert
,
Oded Lachish
,
Tatiana Starikovskaya
Creative Commons Attribution 4.0 International license
In this work, we study periodicity in strings with wildcards. A string T with at most k wildcards is called strongly (p,k)-periodic if the wildcards in T can be replaced with alphabet symbols to obtain a string with period p, and weakly (p,k)-periodic if T[i] matches T[i+p] for all i. Intuitively, both generalize to (≤ g, k)-periodicity, which is the property of being (p,k)-periodic for some p ∈ [1..g].
An ε-tester for a property 𝒫 is an algorithm that distinguishes between strings that satisfy 𝒫 and strings where one needs to change at least an ε-fraction of the symbols to obtain a string that satisfies 𝒫. We study one-sided error testers, where strings satisfying 𝒫 must always be accepted, while strings that are ε-far must be rejected with probability at least 2/3. The complexity of a tester is the worst-case number of symbols of an input of length n it must read to make the decision.
We design the following testers for p,g ≤ n/2:
1) An ε-tester for strong (p,k)-periodicity with complexity Õ_ε(1) .
2) An ε-tester for strong (≤ g,k)-periodicity with complexity Õ_ε(√g).
3) An ε-tester for weak (p,k)-periodicity with complexity Õ_ε(min(k, n /(k+p))).
4) An ε-tester for weak (≤ g,k)-periodicity with complexity Õ_ε(min(k+ √{gk}, n/√k)).
Additionally, we show a lower bound on the complexity of ε-testers for weak (≤ g,k)-periodicity, implying that our tester for weak (≤ g,k)-periodicity is optimal up to a multiplicative (ε^{-1} ln(gk))^O(1) factor for a wide range of g and k. Finally, our tester for strong (≤ g,k)-periodicity generalizes the one of [Lachish and Newman; Algorithmica 2011] for strings without wildcards, matching (up to polylogarithmic factors) the unconditional lower bound of ̃Ω(√g) in said work for constant ε.
@InProceedings{barton_et_al:LIPIcs.CPM.2026.28,
author = {Barton, Carl and Charalampopoulos, Panagiotis and Ghazi, Taha El and Ellert, Jonas and Lachish, Oded and Starikovskaya, Tatiana},
title = {{Periodicity Property Testing on Strings with Wildcards}},
booktitle = {37th Annual Symposium on Combinatorial Pattern Matching (CPM 2026)},
pages = {28:1--28:18},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-420-8},
ISSN = {1868-8969},
year = {2026},
volume = {369},
editor = {Bille, Philip and Prezza, Nicola},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.CPM.2026.28},
URN = {urn:nbn:de:0030-drops-259543},
doi = {10.4230/LIPIcs.CPM.2026.28},
annote = {Keywords: periodicity, property testing, wildcards}
}