比较顺序存储和链接存储两种存储结构的优缺点。(参考教材4.1)

来源:百度知道 编辑:UC知道 时间:2024/05/22 00:26:07
数据结构(B)C 语言描述

/*****************************************************
顺序表算法
严格按照《数据结构C语言版》实现
敬请指正
vincent
2006-12-28
******************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10

typedef int Status;
typedef int ElemType;
/*C中的函数指针类型*/
typedef Status (*cmp)(ElemType x,ElemType i);
typedef void (*vis)();

struct SqList{
ElemType *elem;
int length;
int listsize;
};
/*创建新的顺序表*/
Status InitList(SqList &L);
/*销毁顺序表*/
Status DestroyList(SqList &L);
/*如果顺序表为空TRUE 否则FALSE*/
Status ListEmpty(SqList &L);

/*返回顺序表长