Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8236259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:05:06+00:00 2026-06-07T19:05:06+00:00

The Boyer Moore algorithm has a a preprocessing time of Θ(m + |Σ|) and

  • 0

The Boyer Moore algorithm has a a preprocessing time of Θ(m + |Σ|) and a matching time of Ω(n/m), O(n). I understand that Boyer Moore Horspool is an advancement of Simplified Boyer Moore itself, however its average case complexity is O(N) and worst case O(MN) according to this Wikipedia article. So in the worst case it should be slower than the Boyer Moore algorithm. But this classic survey by University of Chile shows that the Boyer-Moore horspool outperforms Boyer Moore almost every time. I am confused! Which one should I use (for small as well as large patterns) for string searching and which algorithm has a greater significance in the practical world (I am just a Computer science student)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:05:07+00:00Added an answer on June 7, 2026 at 7:05 pm

    The key word is “almost”. The worst-case behavior can be for a vanishingly small number of cases. Average behavior in real life and asymptotic behavior are also rather loosely coupled. The best case behavior of Boyer-Moore-Horspool is the same as for Boyer-Moore. The worst case for Boyer-Moore-Horspool is quite a bit worse than for Boyer-Moore. For typical use, Boyer-Moore-Horspool tends to be about the same as Boyer-Moore, but with a little better (lower) overhead and initialization costs.

    Which one to use? It depends on your goals and what you expect in the way of patterns and text to be searched. Neither is particularly hard to implement, so why not do both and compare the results yourself. (See what happens when you admit that you’re a student? You get an assignment! :))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does the KMP (Knuth–Morris–Pratt) algorithm perform fewer comparisons than the simplified Boyer-Moore algorithm?
I am facing issues in understanding Boyer Moore String Search algorithm. I am following
Wondering, if I want to replace strstr with a better string matching algorithm, like
I would also like to know which algorithm has the worst case complexity of
Below is code directly from the Sun tutorials describing Deadlock. I however don't understand
I run across this often enough that I figure there has to be a
There are many string matching algorithms can be used to find a pattern (string)
I have two tables Boxer and Prospect. Boxers has general stuff like name and
So lets I have a Transactions model. Transactions.rb has: belongs_to :buyer, :class_name => User
I won't go into details, but I'm attempting to implement an algorithm similar to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.