数据结构线性表
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int Status;
1线性表的顺序表示和实现
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef struct{
ElemType *Elem;
int length;
int listsize;
}SqList;
Status InitList_Sq(SqList L){
//构造一个空的线性表L
L.elem=(ElemType*)malloc(LIST_INIT_SIZE*sizeof(ElemType));
If (L.elem==NULL)
exit(OVERFLOW);
else
{
L.length=0;
L.listsize=LIST_INIT_SIZE;
return OK;
}
}
Status DestroyList_Sq(SqList L)
{//销毁线性表L
if(L.elem==NULL)
return ERROR;
els
原创力文档

文档评论(0)