public static void Main() { var pattern = "abcaby"; var text = "abxabcabcaby"; var kmp = new KMP(pattern, text); Console.WriteLine(text); kmp.SearchInArray(pattern, text); }
public static void Main() { // mostly working // not working when pattern length == 1! string pattern = "ab"; string text = "abcasabcjkkabiiabcabckdalkdaabc"; var kmp = new KMP(pattern); int startIndex = 0; while (true) { startIndex = kmp.Search(text, startIndex); if (startIndex == -1) { break; } } Console.WriteLine(counter); }