第2章线性表习题解答.pdfVIP

  • 19
  • 0
  • 约1.4万字
  • 约 27页
  • 2020-12-29 发布于江苏
  • 举报
第 2 章习题 2.1 若将顺序表中记录其长度的分量 listlen 改为指向最后一个元 素的位置 last,在实现各基本运 时需要做那些修改? 【解】 //用线性表最后一个元素的下标 last 代替 listLen 实现顺序表 #define MAXLEN 100 typedef int elementType; typedef struct sllLast { elementType data[MAXLEN]; int last; }seqList; //初始化 void initialList(seqList S) { 1 S.last=-1; } //求表长度 int listLength(seqList S) { return S.last+1; } //按序号取元素 bool getElement(seqList S,int i,elementType x)

文档评论(0)

1亿VIP精品文档

相关文档