Knuth–Morris–Pratt algorithm
string searching algorithm

In computer science, the Knuth–Morris–Pratt algorithm (or KMP algorithm) is a string-searching algorithm that searches for occurrences of a "word" W within a main "text string" S by employing the observation that when a mismatch occurs, the word itself embodies sufficient information to determine where the next match could begin, thus bypassing re-examination of previously matched characters.
The algorithm was conceived by James H. Morris and independently discovered by Donald Knuth "a few weeks later" from automata theory.
Morris and Vaughan Pratt published a technical report in 1970.
The three also published the algorithm jointly in 1977. Independently, in 1969, Matiyasevich discovered a similar algorithm, coded by a two-dimensional Turing machine, while studying a string-pattern-matching recognition problem over a binary alphabet. This was the first linear-time algorithm for string matching.
Background
A string-matching algorithm wants to find the starting index m in string s that matches the search word w.
The most straightforward algorithm, known as the "brute-force" or "naive" algorithm, is to look for a word match at each index m, i.e. the position in the string being searched that corresponds to the character s[m]. At each position m the algorithm first checks for equality of the first character in the word being searched, i.e.
“Knuth–Morris–Pratt algorithm” enters the record as string searching algorithm. Crown Archives preserves that source wording while asking what Knuth, Morris and Pratt can confirm, complicate or overturn.
Why this record matters
“Knuth–Morris–Pratt algorithm” is worth following because a concise public description often conceals a longer documentary argument. Here, Knuth, Morris and Pratt provides the most credible route into that argument.
Named sources, stable identifiers and responsible institutions provide the strongest route from overview to verifiable evidence. The source revision retrieved here is dated Aug 8, 2026. The linked authority identifier is Q45285. 1 of 2 selected statements include explicit references; 0 carry qualifiers and 1 use preferred rank. The first chronological checks are 1970, 1977 and 1969.
Overview language is designed for orientation and should not be treated as a substitute for the evidence cited beneath it. The lead is largely declarative, so disagreement and counter-evidence require a deliberate search beyond the opening account. Authority statements aid reconciliation but still require their own references, qualifiers and ranks to be checked.
How to read it
Use the entry as an orientation point, then follow its citations and revision history. Names, dates and institutional relationships should be checked against the original record.
- Subject orientation
- Search vocabulary
- Locating named sources
The closest primary source, responsible institution and strongest cited specialist reference.
Three-step research path
- Establish the record: confirm the title “Knuth–Morris–Pratt algorithm”, its source revision and the description used here.
- Expand the search: follow Knuth–Morris–Pratt algorithm primary sources, Knuth–Morris–Pratt algorithm archive and Knuth research across catalogues and specialist indexes.
- Test the account: compare the strongest cited source with the responsible institution’s current record and note any disagreement.
Questions for further research
- Which source most directly establishes the central claim about “Knuth–Morris–Pratt algorithm”?
- Which institution is responsible for the underlying evidence?
- What terminology or title could unlock a more precise catalogue search?
Search terms from this dossier
This entry incorporates text from “Knuth–Morris–Pratt algorithm” on English Wikipedia. Contributors are listed in the page history. Text is available under the Creative Commons Attribution-ShareAlike 4.0 License. Selected authority identifiers and statements are retrieved from Wikidata under CC0; their references and qualifiers remain part of the verification path.