数据结构全面代码.pdfVIP

  • 4
  • 0
  • 约24.8万字
  • 约 51页
  • 2019-10-14 发布于江苏
  • 举报
(线性表顺序存储) } #include string.h /* 初始条件:顺序线性表L已存在。操作结果:返回 L #include ctype.h 中数据元素个数 */ #include stdio.h int ListLength(SqList L) #include stdlib.h { #include io.h returnL.length; #include math.h } #include time.h /* 初始条件:顺序线性表L已存在,1≤i≤ListLength(L) */ #define OK 1 /* 操作结果:用 e 返回L 中第i 个数据元素的值,注意i #define ERROR 0 是指位置,第1个位置的数组是从0开始 */ #define TRUE1 StatusGetElem(SqListL,int i,ElemType*e) #define FALSE0 { if(L.length==0 ||i1 ||iL.length) #define MAXSIZE 20/* 存储空间初始分配量 */ returnERROR; *e=L.data[i-1]; typedef int Status; /* Status是函数的类型,其值 是函数结果状态代码,如OK 等 */ returnOK; } typedef int ElemType; /* ElemType 类型根据实际 情况而定,这里假设为int */ /* 初始条件:顺序线性表L 已存在 */ /* 操作结果:返回L中第1 个与e 满足关系的数据元素 的位序。 */ Statusvisit(ElemType c) { /* 若这样的数据元素不存在,则返回值为0 */ printf(%d,c); int LocateElem(SqList L,ElemType e) returnOK;

文档评论(0)

1亿VIP精品文档

相关文档