Abstract
The Knuth-Morris-Pratt (KMP) algorithm for string search is notoriously difficult to understand. Lost in a sea of index arithmetic, most explanations of KMP obscure its essence. This paper constructs KMP incrementally, using pictures to illustrate each step. The end result is easier to comprehend. Additionally, the derivation uses only elementary functional programming techniques.
Cite
CITATION STYLE
APA
Moy, C. (2024). Knuth-Morris-Pratt illustrated. Journal of Functional Programming, 34. https://doi.org/10.1017/S0956796824000017
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.
Already have an account? Sign in
Sign up for free