Least You Need to Know: Prefix Function, Borders, and KMP Intuition
Ouvrir la leçon
The **prefix function** tracks how much of a pattern already matches itself. That self-overlap information is what lets KMP avoid restarting from scratch after mismatches in pattern matching problems.