AlgorithmsStringsEdit on GitHubEdit history
Knuth–Morris–Pratt
1970
A string search that uses a failure function to reuse information about already matched prefixes, finding a pattern in O(n + m) without backing up in the text.
Origin
2 independent origins — credit is split among them
James H. Morris, Vaughan R. Pratt (1970). A Linear Pattern-Matching Algorithm. Technical Report 40, University of California, Berkeley.No digital identifier · Search scholarly sources
Donald E. Knuth, James H. Morris, Vaughan R. Pratt (1977). Fast Pattern Matching in Strings. SIAM Journal on Computing 6(2).doi:10.1137/0206024 — checked against Crossref, 2026-11-08Joint publication including Knuth's independent discovery
Lineage
Algorithms 6 · Relations 7
Derived algorithms
What it led to
Aho–Corasick1975
Reference workGeneralizes the KMP failure function to a trie of the pattern set (standard textbook account)
Two-Way String Matching1991
Author statementThe authors describe the algorithm as intermediate between Knuth–Morris–Pratt and Boyer–Moore. — doi:10.1145/116825.116845
Booth's Least Rotation Algorithm1980
Reference workDescribed as finding the least rotation by adapting the Knuth–Morris–Pratt failure-function preprocessing. — doi:10.1016/0020-0190(80)90149-0
Notable implementations
No implementations registered yet. Try a repo scan to find some. Repo scan
Find more: GitHub · Semantic Scholar · Google Scholar · arXiv
Claims & disputes
Loading…