http://hi.baidu.com/kmj0217/blog/item/5569eb7b1f659dfd0bd18710.html
算法介绍及伪代码查看:http://www-igm.univ-mlv.fr/~lecroq/string/tunedbm.html
The function preBmBc is given chapter Boyer-Moore algorithm.
void TUNEDBM(char *x, int m, char *y, int n) {
int j, k, shift, bmBc[ASIZE];
/* Preprocessing */
preBmBc(x, m, bmBc);
shift = bmBc[x[m - 1]];
bmBc[x[m - 1]] = 0;
memset(y + n, x[m - 1], m);
/* Searching */
j = 0;
while (j < n) {
......
阅读全文