The Boyer-Moore algorithm is a string-searching algorithm. It was developed in 1977 by Robert S. Boyer and J. Strother Moore.
It consists of rules that determine the skipping of characters while matching alignments during the search process. We'll discuss these rules in this Answer.
These are the following two rules for searching in the Boyer-Moore algorithm:
The bad character rule
The good suffix rule
Let
In the bad character rule, we find a character in
In a nutshell, if we mismatch a character, we use the knowledge of the mismatched text character to skip alignments.
Suppose we have a substring
The rightmost copy
If
If such a shift isn't possible, then
In a nutshell, if we match some characters, we use knowledge of the matched characters to skip alignments.
The bad character rule has the runtime
Free Resources