链表操作的测试
来源:互联网 发布:ubuntu 移除源 编辑:程序博客网 时间:2024/05/15 23:43
//1、不含头结点的链表实现
#include <stdio.h>
#include <stdlib.h>
#include "List.h"
int main()
{
struct node* head = NULL;
int a,x,position;
printf("1 for Insert,2 for delete:\n");
while(scanf("%d",&a))
{
if(a==1)
{
printf("Input the position and element:\n");
scanf("%d %d",&position,&x);
head=Insert(head,position,x);
Print(head);
}
else
{
printf("Input the element you want to delete:\n");
scanf("%d",&x);
head=DelNode(head,x);
Print(head);
}
printf("1 for Insert,2 for delete:\n");
}
return 0;
#include <stdio.h>
#include <stdlib.h>
#include "List2.h"
int main()
{
struct node* head = NULL;
int a,x,position;
head=InitialList(head);
printf("1 for Insert,2 for delete:\n");
while(scanf("%d",&a))
{
if(a==1)
{
printf("Input the position and element:\n");
scanf("%d %d",&position,&x);
head=Insert(head,position,x);
Print(head);
}
else
{
printf("Input the element you want to delete:\n");
scanf("%d",&x);
head=DelNode(head,x);
Print(head);
}
printf("1 for Insert,2 for delete:\n");
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include "List.h"
int main()
{
struct node* head = NULL;
int a,x,position;
printf("1 for Insert,2 for delete:\n");
while(scanf("%d",&a))
{
if(a==1)
{
printf("Input the position and element:\n");
scanf("%d %d",&position,&x);
head=Insert(head,position,x);
Print(head);
}
else
{
printf("Input the element you want to delete:\n");
scanf("%d",&x);
head=DelNode(head,x);
Print(head);
}
printf("1 for Insert,2 for delete:\n");
}
return 0;
}
//2、带有头结点的链表实现
#include <stdio.h>
#include <stdlib.h>
#include "List2.h"
int main()
{
struct node* head = NULL;
int a,x,position;
head=InitialList(head);
printf("1 for Insert,2 for delete:\n");
while(scanf("%d",&a))
{
if(a==1)
{
printf("Input the position and element:\n");
scanf("%d %d",&position,&x);
head=Insert(head,position,x);
Print(head);
}
else
{
printf("Input the element you want to delete:\n");
scanf("%d",&x);
head=DelNode(head,x);
Print(head);
}
printf("1 for Insert,2 for delete:\n");
}
return 0;
}
- 链表操作的测试
- 测试链串的基本操作
- 测试数据流的操作
- 对链表进行操作测试
- BSON的基本操作测试。
- 测试对象流的操作
- 二叉排序树的基本操作测试
- C++实现链表的进本操作及测试用例
- 链表的测试
- 链表操作--指针传递 测试与学习
- shell下的文件测试操作命令
- Mainframe 测试中用到的session操作
- 分析jQuery工具的测试操作
- shell下的文件测试操作命令
- php操作memcache的使用测试总结
- php操作memcache的使用测试总结
- MPI_Bcast广播操作的通信开销测试
- php操作memcache的使用测试总结
- 字符串被截断时是否会造成内存泄露
- IOS开发之----常用加密方法(AES、MD5、Base64)
- Convert函数在SQL中转换日期
- ajax学习笔记二
- CF 337E(Divisor Tree-枚举树节点的父亲)
- 链表操作的测试
- 序列化之:事件不可序列化
- CNGI高校驻地网IPv6用户数量排名
- SQL中得到刚刚插入的数据的id
- 块I/O层(I/O调度)
- HDU4148+找规律
- 二分图匹配
- Android设置网络图片为手机背景图片的方法
- display:inline-block的运用