English

Representing Pattern Matching Algorithms by Polynomial-Size Automata

Data Structures and Algorithms 2016-07-04 v1 Formal Languages and Automata Theory

Abstract

Pattern matching algorithms to find exact occurrences of a pattern SΣmS\in\Sigma^m in a text TΣnT\in\Sigma^n have been analyzed extensively with respect to asymptotic best, worst, and average case runtime. For more detailed analyses, the number of text character accesses XnA,SX^{\mathcal{A},S}_n performed by an algorithm A\mathcal{A} when searching a random text of length nn for a fixed pattern SS has been considered. Constructing a state space and corresponding transition rules (e.g. in a Markov chain) that reflect the behavior of a pattern matching algorithm is a key step in existing analyses of XnA,SX^{\mathcal{A},S}_n in both the asymptotic (nn\to\infty) and the non-asymptotic regime. The size of this state space is hence a crucial parameter for such analyses. In this paper, we introduce a general methodology to construct corresponding state spaces and demonstrate that it applies to a wide range of algorithms, including Boyer-Moore (BM), Boyer-Moore-Horspool (BMH), Backward Oracle Matching (BOM), and Backward (Non-Deterministic) DAWG Matching (B(N)DM). In all cases except BOM, our method leads to state spaces of size O(m3)O(m^3) for pattern length mm, a result that has previously only been obtained for BMH. In all other cases, only state spaces with size exponential in mm had been reported. Our results immediately imply an algorithm to compute the distribution of XnA,SX^{\mathcal{A},S}_n for fixed SS, fixed nn, and A{BM,BMH,B(N)DM}\mathcal{A}\in\{\text{BM},\text{BMH},\text{B(N)DM}\} in polynomial time for a very general class of random text models.

Keywords

Cite

@article{arxiv.1607.00138,
  title  = {Representing Pattern Matching Algorithms by Polynomial-Size Automata},
  author = {Tobias Marschall and Noemi E. Passing},
  journal= {arXiv preprint arXiv:1607.00138},
  year   = {2016}
}
R2 v1 2026-06-22T14:40:26.285Z