Yes.
see also
As an extreme example, consider whether we need to find the ABCD pattern in the text 12345678 .
The earliest possible match, of course, begins at the beginning of the text. We are trying to match the pattern back, so we see if we can match D with the 4th character of the text.
? 12345678 ABCD
This is not a coincidence, so we donβt know what not to try to match ABC with the first three characters. We also know (after linear preprocessing) that the character that we find, 4 , does not appear in the template at all, so the earliest possible match that we can find should start from the next position, that is, from the 5th character.
Again we try to match back, so we see if we can match D with the eighth character.
? 12345678 ABCD
Find 8 ; this is not a coincidence. Therefore, the template is not displayed in the text. We needed to see only 2 characters from the text.
This is one of the important characteristics of the Boyer-Moore algorithm: for text of length N and a fixed pattern of length M average productivity is N/M That is, perhaps a little counterintuitively at first, the longer the template we are looking for, the faster we can usually find it.
polygenelubricants
source share