云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 算法与数据结构实验册(顾原翔1413101019)(1)(1)

算法与数据结构实验册(顾原翔1413101019)(1)(1)

  • 62 次阅读
  • 3 次下载
  • 2026/1/9 9:21:59

金陵科技学院实验报告

printf(\

printf(\ scanf(\ for(i=0;i

printf(\ break; }

if(i>=s.curlen) printf(\}

(2)#include

#define maxsize 100 typedef struct{ char ch[maxsize]; int curlen; }seqstring; main(){ int i,flag=0; char ch;

seqstring s={{\ for(i=0;i

printf(\ scanf(\ for(i=0;i

printf(\ flag=1;

金陵科技学院实验报告

} if(flag==0)

printf(\}

(3)#include

#define maxsize 100 typedef struct{ char ch[maxsize]; int length; }seqstring; main(){

seqstring s={{\ int i,k; int m=s.length,j;

printf(\ for(i=0;i<=s.length;i++) printf(\

printf(\ scanf(\ if(i>m-1||i+k>m){ printf(\ return ; }

for(j=i+k;j<=i+m-1;j++) s.ch[j-k]=s.ch[j]; s.length=s.length-k;

printf(\ for(i=0;i<=s.length;i++) printf(\

金陵科技学院实验报告

}

2. #include

#include typedef struct _ChNode { int ch;

struct _ChNode *next; } ChNode;

ChNode* cncreate(const char *str) {

ChNode *head = NULL, *tail, *node; while (*str) {

node = (ChNode *)malloc(sizeof(ChNode)); node->ch = *str; node->next = NULL; if (head == NULL) {

head = node; tail = node; }

tail->next = node; tail = node; str++; }

return head; }

ChNode* cnchr(ChNode *node, int ch) {

金陵科技学院实验报告

while (node) {

if (node->ch == ch) {

return node; }

node = node->next; }

return NULL; }

ChNode* cntail(ChNode *node) {

while (node->next) {

node = node->next; }

return node; }

void cnins(ChNode *a, ChNode *b) {

ChNode *btail = cntail(b); btail->next = a->next; a->next = b; }

void cncat(ChNode *a, ChNode *b, int ch) {

ChNode *node = cnchr(a, ch); if (node == NULL) {

node = cntail(a);

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

金陵科技学院实验报告 printf(\ printf(\ scanf(\ for(i=0;i=s.curlen) printf(\} (2)#include #define maxsize 100 typedef struct{ char ch[maxsize]; int curlen; }seqstring; main(){ int i,flag=0; char ch; seqstring s={{\ for(i=0;i

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com