What is the KMP (Knuth-Morris-Pratt) Algorithm?

What is the KMP (Knuth-Morris-Pratt) Algorithm?

Approach: Explain a string matching algorithm that avoids redundant comparisons.

A string-searching algorithm that searches for occurrences of a 'word' within a main 'text' by using information from previous matches to determine where the next match could begin, avoiding re-scanning.

Follow-up: What is the 'LPS' array?

Key concepts: prefix function, failure function, O(n+m).