Mental Model
KMP finds a pattern in text by remembering where to restart after a mismatch, so it never rechecks characters unnecessarily.
Analogy: Imagine reading a book to find a phrase. Instead of going back to the start after a mismatch, you remember how much of the phrase matched and continue from there.
Text: a b c d a b c d a b c d Pattern: a b c d a b c d Prefix table: [0,0,0,0,1,2,3,4]
