- Brute force
- The Boyer-Moor algorithm
- The Knuth-Morris-Pratt algorithm
In the classic pattern-matching problem, we are given a text string of length n and a pattern string of length m <= n, and must determine whether the pattern is a substring of the text.