C语言编程 帮帮忙哦~~比较顺序存储和链接存储两种存储结构的优缺点

来源:百度知道 编辑:UC知道 时间:2024/05/24 02:16:37
C语言编程 比较顺序存储和链接存储两种存储结构的优缺点。
(1) 分别用顺序存储和链接存储实现线性表的基本操作;
(2) 比较两者的优缺点,并说明两者的适用场合。
谢谢了~~

(1) 分别用顺序存储和链接存储实现线性表的基本操作
顺序存储:
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
#define TRUE 1
#define FALSE 0
#define List_Init_Size 10
#define ListIncrement 2

typedef char ET;
typedef ET * Ep;
typedef int Status;
typedef struct {
ET *elem;
int Length;
int ListSize;
} SqList;

SqList La,Lb,Lc;

/*This program provide some functions for linear table.
Header file writen user are sqlist.h */

#include"stdio.h"
#include"alloc.h"
#include"sqlist.h"

SqList La,Lb,Lc;

/*Output the linear table emements. */
void printsq(SqList *L) {
int i;

printf("Size=%d Length=%d ",L->ListSize,L->Length);
for (i=0;i<L->Length;i++)
printf("%3c"