数据结构实验代码汇总.pdf

数据结构实验代码汇总

第二章 线性表 一、顺序表:SeqList.h,SeqList.cpp 1、SeqList.h #ifndefSEQLIST_H_ #defineSEQLIST_H_ #includeiostream usingnamespacestd; constintdefaultSize=100; templateclassT classSeqList{ private: T*data; // 存放数组 intmaxSize; // 最大可容纳表项的项数 intlast; // 当前已存表项数 public: SeqList(ints =defaultSize); // 构造函数 ~SeqList(){delete[]data;} // 析构函数 intLength()const{returnlast+1;} // 计算表长度 voidmakeEmpty(){last=-1;} // 把表置空 intSearch(Tx)const;

文档评论(0)

1亿VIP精品文档

相关文档