Mental Model
KMP finds a pattern in text by remembering where to restart after a mismatch, avoiding repeated checks.
Analogy: Imagine searching a word in a book and using a bookmark to jump back to the right page instead of starting over from the beginning.
Text: A B C D A B C D A B C D Pattern: A B C D Prefix Table: [0,0,0,0]
