导航菜单
首页 >  考研数据结构真题408  > 全网最全【数据结构与算法】408真题实战(含代码+详解)

全网最全【数据结构与算法】408真题实战(含代码+详解)

线性表专题

每道题目均有对应的代码,大家自行查看哦!

在这里插入图片描述

顺序表 ADT:SeqList

文件名:SeqList.hpp

#include #include using namespace std;// 以上是实际运行所需依赖,考试不用写typedef int elemType;struct SeqList{ elemType *data; // 利用数组存储数据元素 int curLength=0; // 当前顺序表中存储的元素个数 int maxSize; // 顺序表的初始化最大长度 SeqList(int size = 10){maxSize = size; }};/** * 以下为测试方法,考试不用写 */// 初始化数据void init(SeqList *seqlist){ seqlist->data = new elemType[seqlist->maxSize]; for (int i = 1; i data[i - 1] = i;seqlist->curLength++; }}// 自定义初始化数据void initByCustom(SeqList *seqlist){ seqlist->data = new elemType[seqlist->maxSize]; elemType value; cout

相关推荐: