Minggu, 28 Desember 2014

HERE IS A SIMPLE EXAMPLE Boyer-Moore

By fetching the S underlying the last character of the pattern we gain more information about matches in this area of the text.
  • We are not standing on a match (because S isn't E).
  • We wouldn't find a match even if we slid the pattern down by 1 (because S isn't L).
  • We wouldn't find a match even if we slid the pattern down by 2 (because S isn't P).
  • Etc.
In general, since S doesn't occur in the pattern at all we can slide the pattern down by its own length without missing a match. This will align the S we just found with an imaginary one just beyond the front of the pattern. This shift can be precalculated for every element of the alphabet and stored in a table.

Tidak ada komentar:

Posting Komentar