# Knuth-Morris-Pratt

The algorithm's time complexity is ${\displaystyle O(n+m)}$ if ${\displaystyle n}$ and ${\displaystyle m}$ are the lengths of the pattern and the text. This is better than the trivial ${\displaystyle O(nm)}$ solution.
• Boyer-Moore which has a time complexity of ${\displaystyle O(m/n)}$