The Knuth-Morris-Pratt (KMP) algorithm is used for:

Explanation:

KMP efficiently matches patterns in a string with O(n + m) complexity.

Explore more in Computer Science: