Rules for Boyer-Moore search algorithm
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.
Rules for searching
These are the following two rules for searching in the Boyer-Moore algorithm:
The bad character rule
The good suffix rule
Let
The bad character rule
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.
The good suffix rule
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.
Conclusion
The bad character rule has the runtime
Free Resources