Papers
Topics
Authors
Recent
Search
2000 character limit reached

Pattern Matching with Mismatches and Wildcards

Published 12 Feb 2024 in cs.DS | (2402.07732v2)

Abstract: In this work, we address the problem of approximate pattern matching with wildcards. Given a pattern PP of length mm containing DD wildcards, a text TT of length nn, and an integer kk, our objective is to identify all fragments of TT within Hamming distance kk from PP. Our primary contribution is an algorithm with runtime O(n+(D+k)(G+k)n/m)O(n+(D+k)(G+k)\cdot n/m) for this problem. Here, GDG \le D represents the number of maximal wildcard fragments in PP. We derive this algorithm by elaborating in a non-trivial way on the ideas presented by [Charalampopoulos et al., FOCS'20] for pattern matching with mismatches (without wildcards). Our algorithm improves over the state of the art when DD, GG, and kk are small relative to nn. For instance, if m=n/2m = n/2, k=G=n<sup>2/5k=G=n<sup>{2/5}, and D=n<sup>3/5D=n<sup>{3/5}, our algorithm operates in O(n)O(n) time, surpassing the Ω(n<sup>6/5)\Omega(n<sup>{6/5}) time requirement of all previously known algorithms. In the case of exact pattern matching with wildcards (k=0k=0), we present a much simpler algorithm with runtime O(n+DGn/m)O(n+DG\cdot n/m) that clearly illustrates our main technical innovation: the utilisation of positions of PP that do not belong to any fragment of PP with a density of wildcards much larger than D/mD/m as anchors for the sought (approximate) occurrences. Notably, our algorithm outperforms the best-known O(nlogm)O(n\log m)-time FFT-based algorithms of [Cole and Hariharan, STOC'02] and [Clifford and Clifford, IPL'04] if DG=o(mlogm)DG = o(m\log m). We complement our algorithmic results with a structural characterization of the kk-mismatch occurrences of PP. We demonstrate that in a text of length O(m)O(m), these occurrences can be partitioned into O((D+k)(G+k))O((D+k)(G+k)) arithmetic progressions. Additionally, we construct an infinite family of examples with Ω((D+k)k)\Omega((D+k)k) arithmetic progressions of occurrences, leveraging a combinatorial result on progression-free sets [Elkin, SODA'10].

Citations (3)

Summary

No one has generated a summary of this paper yet.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Continue Learning

We haven't generated follow-up questions for this paper yet.

Tweets

Sign up for free to view the 1 tweet with 0 likes about this paper.