数据结构实验项目(C语言版)

来源:百度知道 编辑:UC知道 时间:2024/06/04 12:30:20
实验项目
序号 实验名称 学时 实验性质 开出要求
1 线性表 2 设计性 必做
2 栈与队列 2 设计性 必做
3 二叉树 2 设计性 必做
4 图 2 设计性 必做
5 查找 2 设计性 必做
6 排序 2 设计性 必做

选其中的四个 写算法 不能与他人重复 急求

本人邮箱shuaigehang@163.com

完整版:
单链表
#include "stdio.h"
#include "stdlib.h"

typedef struct NODE
{
int data;
struct NODE *next;
}NODE;

NODE *creat()
{
NODE *head,*p,*q;
int i,n;
q=head=(NODE *)malloc(sizeof(NODE));
head->next=NULL;
printf("\nplease input list_num to the list:");
scanf("%d",&n);
printf("\nplease input list_datas to the list:");
for(i=1;i<=n;i++)
{
p=(NODE *)malloc(sizeof(NODE));
scanf("%d",&p->data);
p->next=NULL;
q->next=p;
q=p;
}
return(head);
}
void print(NODE *head)
{
NODE *p;
p=head->next;
printf("\nTHe list is:");
if(p==NULL)
printf("the list is NULL!\n");
while(p!=NULL)