Boyer-Moore (C#)
调用ShowExample方法即可查看结果 使用Debug配置编译可以查看详细匹配过程 using System; using System.Collections.Generic; namespace Algorithms { /// <summary> /// An implemention of Boyer-Moore algorithm. /// <para/>author : Ornithopter /// </summary> class BoyerMooreSearch { /// <summary> /// /// </summary> /// <param name="source"></param> /// <param name="pattern"></param> /// <returns>An array of matched index</returns> public int[] Search(string source, string pattern) { var matchIndexes = new List<int>(); // step increasment. var delta = 0; // prepare a map providing delta for each char in pattern string. var