Boyer-Moore vs KMP
Boyer-Moore algorithm
- decides how far to jump ahead based on the mismatched character in the text
- works best on large alphabets and natural language texts (e.g. English)
Knuth-Morris-Pratt algorithm
- uses information embodied in the pattern to determine where the next match could begin
- works best on small alphabets (e.g.
A,C,G,T )
For the keen: The article "Average running time of the Boyer-Moore-Horspool algorithm" shows that the time is inversely proportional to size of alphabet
|