Table of Contents
Fetching ...

Dynamic Pattern Matching with Wildcards

Arshia Ataee Naeini, Amir-Parsa Mobed, Masoud Seddighin, Saeed Seddighin

TL;DR

The paper studies fully dynamic pattern matching with wildcards, where both the text and pattern may be updated and wildcards may appear on either side. It introduces a randomized framework with $O(n \log^2 n)$ preprocessing and amortized $\tilde{O}\left(k n^{\frac{k}{k+1}} + k^2 \log n\right)$ update/query time, achieving truly sublinear performance for constant $k$ and for $k = o(\log n)$. A conditional lower bound based on SETH shows that truly sublinear updates cannot be achieved for $k = \Omega(\log n)$ with subquadratic preprocessing. The authors also present two sparse-pattern subroutines: (i) a deterministic FFT+block approach for at most two non-wildcards with preprocessing $O(n^{9/5})$ and update/query $O(n^{4/5}\log n)$, and (ii) a randomized fixed-wildcard-position method with $O(n \omega)$ preprocessing and $O(\omega + \log n)$ updates, where $\omega$ is the number of non-wildcards. These results map the complexity landscape of dynamic wildcard matching and illuminate the trade-offs between preprocessing, update, and query times under structural constraints on the pattern.

Abstract

We study the fully dynamic pattern matching problem where the pattern may contain up to kwildcard symbols, each matching any symbol of the alphabet. Both the text and the pattern are subject to updates (insert, delete, change). We design an algorithm with O(nlog^2 n) preprocessing and update/query time O(knk/k+1 + k2 log n). The bound is truly sublinear for a constant k, and sublinear when k= o(log n). We further complement our results with a conditional lower bound: assuming subquadratic preprocessing time, achieving truly sublinear update time for the case k = Ω(log n) would contradict the Strong Exponential Time Hypothesis (SETH). Finally, we develop sublinear algorithms for two special cases: - If the pattern contains w non-wildcard symbols, we give an algorithm with preprocessing time O(nw) and update time O(w + log n), which is truly sublinear whenever wis truly sublinear. - Using FFT technique combined with block decomposition, we design a deterministic truly sublinear algorithm with preprocessing time O(n^1.8) and update time O(n^0.8 log n) for the case that there are at most two non-wildcards.

Dynamic Pattern Matching with Wildcards

TL;DR

The paper studies fully dynamic pattern matching with wildcards, where both the text and pattern may be updated and wildcards may appear on either side. It introduces a randomized framework with preprocessing and amortized update/query time, achieving truly sublinear performance for constant and for . A conditional lower bound based on SETH shows that truly sublinear updates cannot be achieved for with subquadratic preprocessing. The authors also present two sparse-pattern subroutines: (i) a deterministic FFT+block approach for at most two non-wildcards with preprocessing and update/query , and (ii) a randomized fixed-wildcard-position method with preprocessing and updates, where is the number of non-wildcards. These results map the complexity landscape of dynamic wildcard matching and illuminate the trade-offs between preprocessing, update, and query times under structural constraints on the pattern.

Abstract

We study the fully dynamic pattern matching problem where the pattern may contain up to kwildcard symbols, each matching any symbol of the alphabet. Both the text and the pattern are subject to updates (insert, delete, change). We design an algorithm with O(nlog^2 n) preprocessing and update/query time O(knk/k+1 + k2 log n). The bound is truly sublinear for a constant k, and sublinear when k= o(log n). We further complement our results with a conditional lower bound: assuming subquadratic preprocessing time, achieving truly sublinear update time for the case k = Ω(log n) would contradict the Strong Exponential Time Hypothesis (SETH). Finally, we develop sublinear algorithms for two special cases: - If the pattern contains w non-wildcard symbols, we give an algorithm with preprocessing time O(nw) and update time O(w + log n), which is truly sublinear whenever wis truly sublinear. - Using FFT technique combined with block decomposition, we design a deterministic truly sublinear algorithm with preprocessing time O(n^1.8) and update time O(n^0.8 log n) for the case that there are at most two non-wildcards.
Paper Structure (10 sections, 14 theorems, 50 equations, 17 figures, 1 table, 12 algorithms)

This paper contains 10 sections, 14 theorems, 50 equations, 17 figures, 1 table, 12 algorithms.

Key Result

Theorem 4.2

For strings $A$ and $B$, each of length at most $N$, the query $\texttt{LCS}(A, B)$ can be supported with $\mathcal{O}(N \log^2 N)$ preprocessing time and $\mathcal{O}(\log^8 N)$ time per update operation. Here an update operation may be a substitution, insertion, or deletion applied to either $A$ o

Figures (17)

  • Figure 1: The complexity landscape of fully dynamic pattern matching with $k$ wildcards.
  • Figure 2: Rare-symbol strategy: if the pattern contains a symbol that occurs at most $\tau$ times in the text (here, $b$), enumerate those occurrences and verify only the aligned substrings of length $|P|$.
  • Figure 3: Pattern matching with $\textsf{P} = \texttt{a?b?c}$ and $\textsf{T} = \texttt{aabbccba}$. Yellow boxes represent wildcards. The red dashed region shows the match starting at position $i=2$.
  • Figure 4: Preprocess for Dynamic Pattern Matching with Wildcards
  • Figure 5: Case 1: $\textsf{P}$ contains a rare symbol
  • ...and 12 more figures

Theorems & Definitions (35)

  • Definition 4.1: Polynomial Rolling Hash
  • Example 1
  • Theorem 4.2: charalampopoulos2020dynamic
  • Lemma 4.3: Pairwise Collision Probability
  • proof
  • proof
  • Lemma 4.4
  • proof
  • Lemma 4.5
  • proof
  • ...and 25 more