Knuth-Morris-Pratt animated: the failure table is built first, then mismatches slide the pattern instead of restarting — the text pointer never moves back.
Tip: use samples, upload, copy, download, and send-to actions inside the workspace where available.
KMP Algorithm Visualizer animates Knuth-Morris-Pratt string matching in the two phases it actually has: first the failure table (also called the prefix function or LPS array) is built from the pattern alone, then the search runs using that table to slide the pattern on a mismatch. The insight worth seeing rather than reading is that the text pointer never moves backward — a mismatch reuses what you already matched instead of restarting, which is where the O(n + m) guarantee comes from.
1Build failure table: p[2]='A' equals p[0] → prefix-suffix of length 1 ends here.
build failure[] over the patternfor each text char:if match: advance bothfull match → report, pi = failure[pi-1]mismatch → pi = failure[pi-1] (slide)(never restart the text pointer)done
A failure table remembers how much of the pattern still matches after a mismatch — the text pointer never moves backward.