线性表的动态分配顺序存储结构
线性表存储空间的初始分配量 10
线性表存储空间的分配增量 2
编程实现顺序表示的线性表的基本操作(12个)
Status InitList(SqList &L)
Status DestroyList(SqList &L)
Status ClearList(SqList &L)
Status ListEmpty(SqList L)
int ListLength(SqList L)
Status GetElem(SqList L,int i,ElemType &e)
int LocateElem(SqList L, ElemType e, Status(*compare)(ElemType, ElemType))
Status PriorElem(SqList L,ElemType cur_e,ElemType &pre_e)
Status NextElem(SqList L,ElemType cur_e,ElemType &next_e)
Status ListInsert(SqList &L,int i,ElemType e)
Status ListDelete(SqList &L,int i,ElemType &e)
Status ListTraverse(SqList L,void(*vi)(ElemType&))
主程序验证内容:
编制数据元素判定函数(平方关系)Status comp(ElemType c1,ElemType c2) ,如果c1是c2的平方,返回TRUE,否则返回FALSE。
编制ListTraverse()调用的函数(类型要一致) void visit(ElemType &c),输出c。
编制ListTraverse()调用的另一函数(元素值加倍) void dbl(ElemType &c),使c=c*2。
/* c1.h (程序名) */
#include<string.h>
#include<ctype.h>
#include<mall