数据结构教程(第三版)课后答案.docVIP

  • 180
  • 0
  • 约18.08万字
  • 约 202页
  • 2017-12-07 发布于江西
  • 举报
数据结构教程(第三版)课后答案

/*文件名:algo2-1.cpp*/ #include stdio.h #include malloc.h #define MaxSize 50 typedef char ElemType; typedef struct { ElemType elem[MaxSize]; int length; } SqList; void InitList(SqList *L) { L=(SqList *)malloc(sizeof(SqList)); L-length=0; } void DestroyList(SqList *L) { free(L); } int ListEmpty(SqList *L) { return(L-length==0); } int ListLength(SqList *L) { return(L-length); } void DispList(SqList *L) { int i; if (ListEmpty(L)) return; for (i=0;iL-length;i++) printf(%c,L-elem[i]); printf(\n); } int GetElem(SqList *L,int i,ElemType e) { if (i1 || iL-length) return 0; e=L-elem[i

文档评论(0)

1亿VIP精品文档

相关文档