le , ▁int ▁p ) ▁{ ▁▁▁▁▁▁▁▁ ▁int ▁len ▁= ▁ 0 ; ▁▁▁▁▁▁▁▁ ▁for ▁( int ▁i ▁= ▁p , ▁j ▁= ▁need le . length ▁- ▁ 1 ; ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁ ▁i ▁>= ▁ 0 ▁&& ▁need le [ i ] ▁== ▁need le [ j ]; ▁-- i , ▁-- j ) ▁{ ▁▁▁▁▁▁▁▁▁▁▁▁ ▁len ▁+= ▁ 1 ; ▁▁▁▁▁▁▁▁ ▁} ▁▁▁▁▁▁▁▁ ▁return ▁len ; ▁▁▁▁ ▁} ▁ ▁Vari ants ▁The ▁Bo yer – Mo ore – H ors pool ▁algorithm ▁is ▁a ▁simpl ification ▁of ▁the ▁Bo yer – Mo ore ▁algorithm ▁using ▁only ▁the ▁bad ▁character ▁rule . ▁ ▁The ▁Apost ol ico – G ian car lo ▁algorithm ▁spe eds ▁up ▁the ▁process ▁of ▁checking ▁whether ▁a ▁match ▁has ▁occurred ▁at ▁the ▁given ▁alignment ▁by ▁ski pping ▁explicit ▁character ▁compar isons . ▁This ▁uses ▁information ▁g lean ed ▁during ▁the ▁pre - processing ▁of ▁the ▁pattern ▁in ▁conj unction ▁with ▁suffix ▁match ▁lengths ▁recorded ▁at ▁each ▁match ▁attempt . ▁St oring ▁suffix ▁match ▁lengths ▁requires ▁an ▁additional ▁table ▁equal ▁in ▁size ▁to ▁the ▁text ▁being ▁searched . ▁ ▁The ▁R ait a ▁algorithm ▁impro ves ▁the ▁performance ▁of ▁Bo yer - Mo ore - H ors pool ▁algorithm . ▁The ▁searching ▁pattern ▁of ▁particular ▁sub - string ▁in ▁a ▁given ▁string ▁is ▁different ▁from ▁Bo yer - Mo ore - H ors pool ▁algorithm . ▁ ▁References ▁ ▁External ▁links ▁ ▁Original ▁paper ▁on ▁the ▁Bo yer - Mo ore ▁algorithm ▁An ▁example ▁of ▁the ▁Bo yer