数据结构实验三实验报告(7)
时间:2025-07-11
时间:2025-07-11
数据结构实验报告
int i= start, j=0, v;
while(i<S.length && j<T.length)
{
if(S.str[i]==T.str[j])
{
i++;
j++;
}
else
{
i=i-j+1;
j=0;
}
}
if(j==T.length)
v=i-T.length;
else
v=-1;
return v;
}
void GetNext(String T, int next[])
{
int j=1, k=0;
next[0]=-1;
next[1]=0;
while(j<T.length)
{
if(T.str[j]==T.str[k])
{
next[j+1]=k+1;
j++;
k++;
}
else if(k==0)
{
next[j+1]=0;
j++;
}
else k=next[k];
}
}
上一篇:2014年山东高职专科排名总表
下一篇:海鲜厨房教学设计