Implementation of Boyer Moore Algorithm
Implementation of Boyer Moore Algorithm
Soumalya De
Paper Name: Advance Data Structure
Department: CSE
Date:25/11/2021
Solution:
# include <stdio.h>
# include <limits.h>
# include <string.h>
int badchar[NO_OF_CHARS])
int i;
badchar[i] = -1;
badchar[(int) str[i]] = i;
{
int m = strlen(pat);
int n = strlen(txt);
int badchar[NO_OF_CHARS];
badCharHeuristic(pat, m, badchar);
int s = 0;
int j = m-1;
j--;
if (j < 0)
else
s += max(1, j - badchar[txt[s+j]]);
}
int main()
search(txt, pat);
return 0;
Output:
pattern occurs at shift = 6