paper

Representing Pattern Matching Algorithms by Polynomial-Size Automata

arXiv:1607.00138

Abstract

Pattern matching algorithms to find exact occurrences of a pattern in a text have been analyzed extensively with respect to asymptotic best, worst, and average case runtime. For more detailed analyses, the number of text character accesses performed by an algorithm when searching a random text of length for a fixed pattern 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 in both the asymptotic () 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 for pattern length , a result that has previously only been obtained for BMH. In all other cases, only state spaces with size exponential in had been reported. Our results immediately imply an algorithm to compute the distribution of for fixed , fixed , and in polynomial time for a very general class of random text models.

Representing Pattern Matching Algorithms by Polynomial-Size Automata · wovepaper