8000 GitHub - siten/boyer-moore-string-search: Boyer Moore string search implementation in C
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

siten/boyer-moore-string-search

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boyer-moore-string-search

Boyer-Moore string search algorithm implementation in C.

The algorithm performs its matching backwards, from right to left and proceeds by iteratively matching, shifting the pattern, matching, shifting, etc. The shift amount is calculated by applying these two rules:

  1. the bad character rule
  2. good suffix rule

An actual shifting offset is the maximum one of them.

  • delta1 - the "Bad Character" table

This table contains an entry for every character in the alphabet. The entry for char specifies how far the pattern should be right shifted when chars found in the string and it does not match the current pattern character.

  • delta2 - the "Good Suffix" table

This table contains an entry for each character in the pattern. The entry for pattern[j] specifies how far the current string position should shift to the right when pattern[j-1] does not match the string but the suffix at pattern[j .. patlen-1] does match.

Usage

To compile and execute the tests:

$ make
$ ./bm

To remove the compiled file:

$ make clean

Sample Output

Sample Output

About

Boyer Moore string search implementation in C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.4%
  • Makefile 1.6%
0