06 2022 档案
摘要:通过链表实现栈 #include<iostream> #include "chainList.cpp" using namespace std; template<class T> class linkedStack { public: explicit linkedStack(int initia
阅读全文
摘要:构建数组栈类 代码 #include <iostream> using namespace std; // 改变一个一维数组的长度 template<class T> void changeLength1D(T *&a, int oldLength, int newLength) { if (new
阅读全文
摘要:对角矩阵类(部分方法C++) 代码 #include<iostream> using namespace std; template<class T> class diagonalMatrix { public: explicit diagonalMatrix(int theN = 10); ~di
阅读全文
摘要:#include<iostream> using namespace std; template<class T> class matrix { public: matrix(int theRows = 0, int theColumns = 0); matrix(const matrix<T> &
阅读全文
摘要:#include<iostream> using namespace std; int main() { int numberOfRows = 5; // 定义每一行的长度 int length[5] = {6, 3, 4, 2, 7}; // 声明一个二维数组变量 // 分配所需要的行 int *
阅读全文
摘要:#include<iostream> using namespace std; // 使用数组实现的并查集算法 int *equivClass;// 等价类数组 int n;//元素个数 void initialize(int numberOfElements) { // 用每个类的一个元素,初始化
阅读全文
摘要:箱排序 假定用一个链表保存一个班级学生清单。结点的数据有:学生姓名和考试分数。假设分数是0~100的整数。 采用箱排序可以把分数相同的结点放在同一个箱子里,然后把箱子连接起来就得到了有序的链表 链表定义 #include<iostream> #include <sstream> using name
阅读全文

浙公网安备 33010602011771号