Hard

KMP Algorithm

Knuth-Morris-Pratt precomputes how far to jump after a mismatch, using the pattern’s own borders. The text is never rewound.

Costs

CategoryAlgorithm
DifficultyHard
Build the failure tableO(m)
SearchO(n)
TotalO(n + m)

Questions

What is KMP Algorithm?

Knuth-Morris-Pratt precomputes how far to jump after a mismatch, using the pattern’s own borders. The text is never rewound.

Where do I practice it?

DSA Master keeps challenges and progress on the phone. This page is the idea and the costs.