Fast Pattern Matching in Strings

Donald E. Knuth, James H. Morris, Jr., Vaughan R. Pratt

1977Published
2.0KCitations
0References
journal articleType

Abstract

An algorithm is presented which finds all occurrences of one given string within another, in running time proportional to the sum of the lengths of the strings. The constant of proportionality is low enough to make this algorithm of practical use, and the procedure can also be extended to deal with some more general pattern-matching problems. A theoretical application of the algorithm shows that the set of concatenations of even palindromes, i.e., the language $\{\alpha \alpha ^R\}^*$, can be recognized in linear time. Other algorithms which run even faster on the average are also considered.

Journal: SIAM Journal on Computing

Publisher: Society for Industrial & Applied Mathematics (SIAM)

Citations are the number of DOI-registered works in Crossref that cite this paper; references are how many works it cites. Full text is on the publisher site via the DOI link.