DSAverse
String Algorithms
Loading String Algorithms...
Pattern Matching
A
B
A
B
C
A
B
A
B
A
B
A
B
text / pattern
Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
String Algorithms
Loading String Algorithms...
Pattern Matching
text / pattern
Knuth-Morris-Pratt uses a precomputed failure function to skip re-scanning characters already matched. O(n + m) guaranteed.
What does the failure function (LPS array) store at position i?