algorithm

Boyer-Moore

The Boyer-Moore algorithm is an efficient string-searching algorithm that finds occurrences of a pattern within a text. It works by preprocessing the pattern to create two heuristics—the bad character rule and the good suffix rule—which allow it to skip sections of the text, often achieving sub-linear time complexity in practice. This makes it particularly fast for large texts and patterns, such as in text editors or DNA sequence analysis.

Also known as: Boyer Moore, Boyer-Moore string search, BM algorithm, Boyer-Moore-Horspool, Boyer-Moore-Sunday
🧊Why learn Boyer-Moore?

Developers should learn and use the Boyer-Moore algorithm when implementing high-performance string search operations, such as in search engines, text processing tools, or bioinformatics applications. It is especially valuable in scenarios where the text is large and the pattern is relatively long, as its ability to skip characters reduces the number of comparisons needed, leading to significant speed improvements over naive methods.

Compare Boyer-Moore

Learning Resources

Related Tools

Alternatives to Boyer-Moore