easteregg Leprechaun
  • Patrick Collins
    • Home
    • Blog
      • eJPTv1 Certification
      • Conferences

      • Blog Home
    • Travel Photos
    • Notes
    • Graduation!
    • Projects and University Work
      • Honours Project
      • Web App Pen Test

      • All projects
    • Socials
    • About Me

    Threaded Boyer-Moore-Horspool Algorithm

    hourglass with red sand

    About

    • Module: CMP202
    • Title: Data Structures and Algorithms 2
    • Grade: B+

    In this module I was introduced to the wonderful world of threading. I learned methods to parallelise and speed up a program such as using task farms. For my assignment I had to parallelise a program, choosing CPU multicore or GPU devices. Or even both. I only focused on doing CPU multicore.

    I wasn't happy with my previous Boyer-Moore-Horspool program as I now knew a much better and efficient way to implement the algorithm. I knew it could be sped up significantly and that's what I set out to do for my assignment.

    Usage

    This time the user can enter more settings for the Boyer-Moore-Horspool algorithm. Such as:

    • What word to search.
    • Number of threads to use.
    • Number of iterations to run.

    Below is a video demonstration of my program. I chose to search "the", as it took my previous term's program significantly longer to search smaller words. However with threading implemented, you'll see that small words now have no impact on the speed the algorithm searches. Like the previous program, this algorithm also searches the same text file called "jute_book".

    Your browser does not support the video tag.

    I'm so proud of this program and had a lot of fun threading this algorithm. I set out to achieve speeding up Boyer-Moore-Horspool with threading and it turned out great. As you can see from the video, it searches the whole text file in 5 milliseconds even with a smaller word! Keep in mind this is also only running 6 threads, when 8 could be run.

    Although to note, the text is split leaving a range with decimal. For example 29562.8. In a very rare chance, the algorithm could actually skip over a word and not find the desired string due to this. This was one of the major errors of my program from threading it and I didn't have enough time to correct it. I never experienced this error during the project, but I was aware of its possibility.

    Timing

    The below image displays the text file the program creates. The time is printed out in milliseconds. "BM_Timings" is Boyer-Moore-Horspool's results.

    Timing files from the Program

    Presentation

    In this presentation I have explained the mechanics of my program and further timing results with boxplots.

    Please DO NOT plagiarise my presentation. You will be caught, it's not worth it.


    <> Code

    If you would like to check out the code, or download and try yourself, have a look at the repository below.

    Please DO NOT plagiarise my code. You will be caught, it's not worth it.

    Project's Github Repository

    CMP202 Threaded Boyer-Moore-Horspool Algorithm

    Improving upon my term one project, I decided to thread Boyer-Moore-Horspool.


    Copyright © 2022-2025 Patrick Collins
    Contact Me: Contact@paddylonglegs.site
    Background created by freepik