Skip to content

Glossary: Algorithms Beyond the Basics in Go

KMP (Knuth-Morris-Pratt)

Also written: KMP, string matching

A fast string-matching algorithm that finds a pattern inside a longer text in O(n + m) time. It avoids rechecking letters by using a table built from the pattern itself.

Where the book teaches it