自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 数据结构、算法与应用 搜索树

dictionary.h//抽象类词典//字典数据结构的抽象数据类型规范//所有方法都是纯虚函数//K是键类型,E是值类型#ifndef DICTIONARY_H#define DICTIONARY_Husing namespace std;template<class K, class E>class dictionary { public: virtual ~dictionary() {} virtual bool empty()

2021-12-28 20:45:22 416

原创 数据结构、算法与应用 12.6.3 霍夫曼编码-霍夫曼树

queue.h#ifndef QUEUE_H#define QUEUE_Htemplate <typename T>class queue{public: virtual ~queue(); virtual bool empty() const = 0; // 返回 true,当且仅当当前队列为空 virtual int size() const = 0; // 返回队列中元素个数 virtual T& front() = 0;

2021-12-28 20:42:24 192

原创 数据结构、算法和应用 竞赛树-用相邻适配法求解箱子装载问题

binType.h// 用于首次装配包装的类别#ifndef BINTYPE_H#define BINTYPE_Hstruct binType{ int unusedCapacity; // 未使用容量 bool operator <= (binType& right) const {return (unusedCapacity >= right.unusedCapacity) ? true : false;}};#endiffi

2021-12-26 13:01:31 156

原创 数据结构、算法与应用 13.3 赢者树

winnerTree.h#ifndef WINNERTREE_H#define WINNERTREE_Htemplate<typename T>class winnerTree{public: virtual ~winnerTree() {} virtual void initialize(T *thePlayer, int theNumberOfPlayers) = 0; // 用数组 thePlayer[1:numberOfPlayers] 生成赢者树 virtu

2021-12-24 17:59:45 750

原创 数据结构、算法与应用 12.6.2 机器调度(第十二章 315页)

#ifndef JOBNODE_H#define JOBNODE_Hstruct jobNode{ int id; // 作业号 int time; // 处理时间 jobNode() = default; jobNode(int cheId, int theTime) {id = cheId; time = theTime;} operator int() const {return time;}};#endif // !JOBNODE.

2021-12-22 12:33:04 259

原创 数据结构、算法与应用 第十章 跳表 skip

//跳过列表中使用的节点类型//具有下一个和元素字段的节点;元素是一对<const K,E>//接下来是指针的一维数组#ifndef SKIPNODE_H#define SKIPNODE_Htemplate<typename K, typename E>struct skipNode{ typedef pair<const K, E> pairType; pairType element; skipNode<K, E> **next;.

2021-11-30 14:34:44 185

原创 数据结构、算法 程序 9-10 工厂仿真的主要程序

#include "arrayQueue.h"// 工序、任务 、机器、事件表// 程序 9-11struct task{// 任务 int machine; // 执行该工序的机器 int time; // 完成该工序所需要的时间 task(int theMachine = 0, int theTime = 0) { machine = theMachine; time = theTime; }};// 程序 9-12struct job.

2021-11-28 19:11:53 113

原创 数据结构与算法:队列 arrayQueue

#ifndef arrayQueue_#define arrayQueue_#include "queue.h"#include "myExceptions.h"#include <sstream>using namespace std;template<class T>class arrayQueue : public queue<T>{ public: arrayQueue(int initialCapacity = 10);.

2021-11-25 10:36:10 395

原创 数据结构、算法:程序 8-14 离线等价类程序

#include <iostream>#include "arrayStack.h"using namespace std;int main(){ int n, // 元素个数 r; // 关系个数 cout << "输入元素个数" << endl; cin >> n; if (n < 2) { cout << "元素太少".

2021-11-24 10:30:04 636

原创 数据结构-7-10 类 tridiagonalMatrix

#ifndef TRIDIAGONALMATRIX_H#define TRIDIAGONALMATRIX_H#include "matrixIndexOutOfBounds.h"template<class T>class tridiagonalMatrix { public: tridiagonalMatrix(int theN = 10); ~tridiagonalMatrix() {delete [] element;} T get(i.

2021-11-23 10:13:32 65

原创 数据结构8.5.3 列车车厢重排

#include <iostream>#include "arrayStack.h"#include "myExceptions.h"using namespace std;arrayStack<int>* track; // 缓冲轨道数组int numberOfCars; // 车厢数量int numberOfTracks; // 轨道数量int smallestCar; // 在缓冲轨道中编号最小.

2021-11-23 10:11:19 1081

原创 数据结构 7-12 lowerTriangularMatrix<T>::set

#ifndef LOWERTRIANGULARMATRIX_H#define LOWERTRIANGULARMATRIX_H#include "matrixIndexOutOfBounds.h"#include "illegalParameterValue.h"template<class T>class lowerTriangularMatrix { public: lowerTriangularMatrix(int theN = 10); ~lo.

2021-11-20 06:13:30 677

原创 数据结构-类 diagonalMatrix

#ifndef DIAGONALMATRIX_H#define DIAGONALMATRIX_H#include "illegalParameterValue.h"#include "matrixIndexOutOfBounds.h"template<typename T>class diagonalMatrix{public: diagonalMatrix(int theN = 10); ~diagonalMatrix() {delete [] element;} T .

2021-11-20 02:46:53 501

原创 数据结构-矩阵类 matrix

#ifndef MATRIX_H#define MATRIX_H#include "illegalParameterValue.h"#include "matrixIndexOutOfBounds.h"template<typename T>class matrix{ friend std::ostream& operator<<(std::ostream&, const matrix<T>&);public: matrix(.

2021-11-20 02:13:59 999

原创 数据结构-程序7-1:一个不规则二维数组的创建和使用

#include <iostream>using namespace std;int main(){ int numberOfRows = 5; // 定义每一行的长度 int length[5] = {6, 3, 4, 2, 7}; // 声明一个二维数组变量 // 且分配所需要的函数 int **irregularArray = new int* [numberOfRows]; for (int i = 0; i < numberOfRows; i++).

2021-11-19 00:50:30 474

原创 数据结构-6-21- 使用链表和整型指针实现的并查集算法

#ifndef EQUIVNODE_H#define EQUIVNODE_H#include <iostream>struct equivNode{ int equivClass, // 元素类标识符 size, // 类的元素个数 next; // 类中指向下一个元素的指针};equivNode* node; // 节点的数组int.

2021-11-18 23:23:29 256

原创 数据结构-程序6-19 使用数组实现的并查集算法

#include <iostream>int *equivClass, // 等价类数组 n; // 元素个数void initialize(int numberOfElements){// 用每一个类的一个元素,初始化 numberOfElements 个类 n = numberOfElements; equivClass = new int[n + 1]; for (int e = 1; e <= n; e++) equi.

2021-11-18 21:25:51 301

原创 数据结构---箱子排序(链表) chain<T>::binSort(int range)

template<typename T>void chain<T>::binSort(int range){ // 创建并初始化箱子 chainNode<T> **bottom, **top; bottom = new chainNode<T>* [range + 1]; top = new chainNode<T>* [range + 1]; for (int b = 0; b <= range; b++) bott...

2021-11-17 03:59:35 329

原创 2021-11-16

以后通过csdn的博客记录自己的学习生涯

2021-11-16 04:05:55 132

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除