void get_next(char *T,int *next)
{
int i = 1,j = 0;
next[1] = 0;
while( i < strlen(T) )
{
if(j == 0 || T[i-1] == T[j-1]){
next[++i] = ++j;
}
else
{
j = next[j];
}
}
}
数据结构kmp算法next函数
最新推荐文章于 2023-03-16 22:40:31 发布