- 17
- 0
- 约4.65千字
- 约 8页
- 2018-01-09 发布于河南
- 举报
顺序表的定义及基本操作和单链表的定义及基本操作
数据结构实验报告 壹
题目一:顺序表的定义及基本操作
题目二:单链表的定义及基本操作
班级: 信息一班
姓名:
学号:
得分: ____ (满分2.5分)
线性表
#includeiostream.h
#define OVERFLOW -2
#define OK 1
#define ERROR 0
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef int ElemType;
typedef int status;
typedef struct
{
ElemType *elem;
int length;
int listsize;
}sqlist;
status lnitlist_sq(sqlist L)
{
L.elem=new ElemType[LIST_INIT_SIZE];
if(!L.elem)
coutOVERFLOW;
L.length=0;
L.listsize=LIST_INIT_SIZE;
return OK;
}
int LocateElem(sqlist L, ElemType e)
{
int *p ;
p=L.elem; int i=1;
while(i=L.length *p++!=e)
原创力文档

文档评论(0)