Skip to content

This repository houses two Python scripts for string matching algorithms - 'naive_matching' and 'booyer-moore-horspool.' These scripts are designed to efficiently search for occurrences of one string (the pattern) within another (the text).

Notifications You must be signed in to change notification settings

OscarFa28/String-Matching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

String-Matching

Naive Matching: The naive matching algorithm, also known as "brute force," is the simplest method for searching for a pattern in a text string. It works by comparing the pattern with every possible substring of the main text string. It starts at the first position of the text string and slides the pattern one position at a time until it finds a match or reaches the end. It is easy to implement but can be inefficient on long text strings due to the large number of required comparisons.

Boyer-Moore-Horspool: The Boyer-Moore-Horspool algorithm is a more sophisticated algorithm for pattern searching in text strings. It is based on the idea of skipping several positions in the text string when a mismatch is encountered between the pattern and the text. It uses two main heuristics: the last character of the pattern (Boyer-Moore rule) and a skip table (Horspool rule) based on the characters in the pattern. These heuristics allow it to avoid many unnecessary comparisons, making it efficient in most practical cases. The Boyer-Moore-Horspool algorithm is widely used in text search applications due to its speed and efficiency.

About

This repository houses two Python scripts for string matching algorithms - 'naive_matching' and 'booyer-moore-horspool.' These scripts are designed to efficiently search for occurrences of one string (the pattern) within another (the text).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages