好文档 - 专业文书写作范文服务资料分享网站

算法与数据结构实验

天下 分享 时间: 加入收藏 我要投稿 点赞

.

p=(Node*)malloc(sizeof(Node)); p->data=x; r->next=p; r=p;

}

r->next=NULL; return head; }

void output(Linklist head) { }

void main()

printf(\ do{

printf(\ p=p->next; p=head->next; Linklist p;

}while(p);

.

.

{ } (2)

#include #include typedef struct node {

int data;

struct node *next; } linklist; main() { int x,y;

Linklist head; int x,n;

printf(\输入数字的个数(n):\\n\ scanf(\ head=creat(n); printf(\输出数字:\\n\ output(head);

.

.

linklist *h,*s,*r,*p,*q,*m,*n; h=malloc(sizeof(linklist)); r=h;

printf(\请输入一个数组 :\ scanf(\ while(x!=0) {

s=malloc(sizeof(linklist)); s->data=x; r->next=s; r=s;

scanf(\ }

r->next=NULL; printf(\请输入插入值:\ scanf(\ p=h->next; while(p!=NULL) {

if ((p->data)

p=p->next;

else

.

.

}

break;

q=malloc(sizeof(linklist)); q->data=y; m=h;

while(m->next!=p)

m=m->next;

q->next=p; m->next=q; n=h->next;

printf(\这个链表是:\ while(n!=NULL) {

printf(\ n=n->next; } } (3)

#include #include typedef struct node {

.

.

int data;

struct node *next; } linklist; main() { int x;

linklist *h,*s,*r,*p,*q,*t; h=malloc(sizeof(linklist)); r=h;

printf(\请输入一个数组:\ scanf(\ while(x!=-1) {

s=malloc(sizeof(linklist)); s->data=x; r->next=s; r=s;

scanf(\ }

r->next=NULL;

printf(\这个链表是:\\n\

.

算法与数据结构实验

.p=(Node*)malloc(sizeof(Node));p->data=x;r->next=p;r=p;}r->next=NULL;returnhead;}voidoutput(
推荐度:
点击下载文档文档为doc格式
211gk4xogs9sc9l3ppnv1xep036fj7019e6
领取福利

微信扫码领取福利

微信扫码分享