[prev] 37 [next]

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)