数据结构教程课答案.doc

数据结构教程课答案

数据结构教程课后答案 /*文件名: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)

文档评论(0)

1亿VIP精品文档

相关文档