Intermediate Data Structures & Algorithms
Q50 / 100

What is the Knuth-Morris-Pratt (KMP) algorithm used for?

Correct! Well done.

Incorrect.

The correct answer is B) Efficient string pattern matching in O(n + m) time

B

Correct Answer

Efficient string pattern matching in O(n + m) time

Explanation

KMP preprocesses the pattern to build a failure function, avoiding redundant character comparisons, achieving O(n + m) where n is text length and m is pattern length.

Progress
50/100