Boyer Moore Pattern Matching Algorithm

/***************************************************** * Boyer Moore Pattern Matching Algorithm * 20060427 by daineng@nj.cpsecure *****************************************************/这个算法的特点在于从patt
摘要由CSDN通过智能技术生成

/*****************************************************
 * Boyer Moore Pattern Matching Algorithm
 * 20060427 by
daineng@nj.cpsecure
 *****************************************************/

这个算法的特点在于从pattern的最后一位开始比较,一旦不
符合则把pattern提前到当前比较位置上的元素和pattern中某
个一致为止。

Boyer_Moore的算法说明有很多,但不是很明白,结合下面的
数据将会很容易理解这个算法。(由于字符位置比较重要,
下面的例子需要在等字符宽度的字体下显示才有效果)

抱歉我没有太多的时间说明这个问题。

-------------------------------------------------
         1         2         3         4
1234567890123456789012345678901234567890123456789
-------------------------------------------------
This is a test of the Boyer Moore algorithm
algorithm
87654321
        >> (sf['a'] - 0) = 8
        algorithm
                 >> (sf['f'] - 0) = 9
                 algorithm
                          >> (sf['e'] - 0) = 9
                          algorithm
                                  >> (sf['a'] - 0 = 8
                                  algorithm

-------------------------------------------------
         1         2         3         4
1234567890123456789012345678901234567890123456789
-------------------------------------------------
CooBooooBooooo
Booooo
51111
   >> (sf['B'] - 2) = 3
   Booooo
        >> (sf['B'] - 0) = 5
        Booooo

          |
    xxxxBooooxxxx
      Boooo
          |

-------------------------------------------------
         1         2         3         4
1234567890123456789012345678901234567890123456789
-------------------------------------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值