Complexity of Sequential Pattern Matching Algorithms
We formally define a class of sequential pattern matching algorithms that includes all variations of Morris-Pratt algorithm. For the last twenty years it was known that the complexity of such algorithms is bounded by a linear function of the text length. Recently, substantial progress has been made in identifying lower bounds. We now prove there exists asymptotically a linearity constant for the worst and the average cases. We use Subadditive Ergodic Theorem and prove an almost sure convergence. Our results hold for any given pattern and text and for stationary ergodic pattern and text. In the course of the proof, we establish some structural property, namely, the existence of “unavoidable positions” where the algorithm must stop to compare. This property seems to be uniquely reserved for Morris-Pratt type algorithms (e.g., Boyer and Moore algorithm does not possess this property).
Unable to display preview. Download preview PDF.
- 6.D. Breslauer, L. Colussi, and L. Toniolo, Tight Comparison Bounds for the String Prefix-Matching Problem, Proc. 4-th Symposium on Combinatorial Pattern Matching, Padova, Italy, 11–19. Springer-Verlag, 1993.Google Scholar
- 8.L. Colussi, Z. Galil, and R. Giancarlo, On the Exact Complexity of String Matching, Proc. 31-st Annual IEEE Symposium on the Foundations of Computer Science, 135–143. IEEE, 1990.Google Scholar
- 9.M. Crochemore and W. Rytter, Text Algorithms, Oxford University Press, New York 1995.Google Scholar
- 13.C. Hancart, Analyse Exacte et en Moyenne d’Algorithmes de Recherche d’un Motif dans un Texte, These, l’Universite Paris 7, 1993.Google Scholar
- 15.J.F.C. Kingman, Subadditive Processes, in Ecole d’Eté de Probabilités de Saint-Flour V-1975, Lecture Notes in Mathematics, 539, Springer-Verlag, Berlin 1976.Google Scholar
- 18.M. Régnier, Knuth-Morris-Pratt Algorithm: An Analysis, Proc. Mathematical Foundations for Computer Science 89, Porubka, Poland, Lecture Notes in Computer Science, 379, 431–444. Springer-Verlag, 1989.Google Scholar
- 19.I. Simon, String Matching Algorithms and Automata, First South-American Work-shop on String Processing 93, Belo Horizonte, Brazil, R. Baeza-Yates and N. Ziviani, ed, 151–157, 1993.Google Scholar