Boyer-Moore String Search: - How Does It Work? - Examples - Complexity - Acknowledgements
Boyer-Moore String Search: - How Does It Work? - Examples - Complexity - Acknowledgements
Boyer-Moore String Search: - How Does It Work? - Examples - Complexity - Acknowledgements
At every step, it slides the pattern by the max of the slides suggested by
the two heuristics. So it uses best of the two heuristics at every step.
Case 2: A prefix of P, which matches with suffix of t in T
It is not always likely that we will find the occurrence of t in P.
Sometimes there is no occurrence at all, in such cases sometimes we can search for
suffix of t matching with some prefix of P and try to align them by shifting P.
For example –
Case 3: P moves past by 1
If the above two cases are not satisfied, we will shift the
pattern past the t. For example