Last active
August 29, 2015 14:07
-
-
Save icarofreire/fb2e9231d8298514cbaf to your computer and use it in GitHub Desktop.
Função de processamento pré - KMP.
This file contains 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
int* meu_pre_kmp(char *pattern) | |
{ | |
int *g = malloc(sizeof(int)*strlen(pattern)); | |
int i, n=0, estado=1; | |
repi(i, 1, strlen(pattern)) | |
{ | |
if( pattern[n] != pattern[i] ) | |
{ | |
g[i]=0; | |
}else{ | |
g[i]=estado; | |
estado++; | |
n++; | |
} | |
} | |
return g; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment