Boyer-Moore 算法
概述与对比
KMP算法并不是效率最高的算法,实际采用并不多。各种文本编辑器的”查找”功能(Ctrl+F),大多采用Boyer-Moore算法。Boyer-Moore算法不仅效率高,而且构思巧妙,容易理解。
伪码
while (!matched && !exhausted)
{
while (pattern char != text char)
{
shift pattern as far right as possible;
// Amount to shift pattern to the right is
//