This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
void kmp_search(string haystack, string needle){ | |
int N, M, i, j, len; | |
N = haystack.length(); | |
M = needle.length(); | |
// Longest Proper Suffix array or Partial match Table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
using namespace std; | |
int *pre_kmp(string pattern) | |
{ | |
int size = pattern.size(); | |
int *pie=new int [size]; | |
pie[0] = 0; |