数据结构实验三实验报告(5)

时间:2025-07-11

数据结构实验报告

count=BFIndexC(S2,0,T2);

printf("the comparison counts of Brute-Force is:%d\n",count);

GetNext(T2, next);

count=KMPIndexC(S1,0,T2,next);

printf("the comparison counts of KMP is:%d\n",count);

}

4-20

/*SString.h*/

typedef struct

{

char str[MaxSize];

int length;

}String;

void Initiate(String *S)

{

S->length=0;

}

int Insert(String *S, int pos, String T)

{

int i;

if(pos<0||pos>S->length)

{

printf("The parameter pos is error!\n");

return 0;

}

else if(S->length+T.length>MaxSize)

{

printf("The space of the array is not enough!\n");

return 0;

}

else

{

for(i=S->length-1; i>=pos; i--)

S->str[i+T.length]=S->str[i];

for(i=0; i<T.length; i++)

S->str[pos+i]=T.str[i];

S->length=S->length+T.length;

return 1;

}

}

数据结构实验三实验报告(5).doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219