![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Data Structure
JacobTsang
Feel free to contact me!
QQ:853802088
展开
-
带表头结点
带表头结点一元多项式的创建、输出、撤销以及两个一元多项式相加和相乘#include <stdio.h>#include <stdlib.h>#include <malloc.h>#include <time.h>#define ERROR 0#define OK 1#define Overflow 2#define Underflo...原创 2019-04-24 17:18:07 · 969 阅读 · 0 评论 -
高度 | 交换 | 打印二叉树 | 二叉树树形可视化 | C
BinaryTreeNode.cpp/*设二叉树以二叉链表方式存储,试编写求解下列问题的递归算法。设二叉树结点和二叉树结构体定义如下:(1)求一棵二叉树的高度;(2)求一棵二叉树中的结点个数;(3)交换一棵二叉树中每个结点的左、右子树。*/#include<iostream>#include<cstring>#include <stdio.h&g...原创 2019-06-29 10:31:57 · 470 阅读 · 0 评论 -
m叉B树 | 删除操作 | 流程图
下溢: 元素的个数小于⌈m/2⌉ - 1旋转借:双亲下移,兄弟上移总结自南京邮电大学慕课视频:https://www.icourse163.org/spoc/learn/NJUPT-1003118002?tid=1206054203#/learn/content?type=detail&id=1210462749&cid=1213274046...原创 2019-06-23 19:44:00 · 617 阅读 · 0 评论 -
二叉搜索树 | 中序遍历 | 插入 | 删除 | 查找 | 输出
#include <stdio.h>#include <iostream>#include <stdlib.h>#include <time.h>using namespace std;typedef struct bstnode{ int key; struct bstnode *lChild,*rChild; ...原创 2019-06-18 14:46:29 · 370 阅读 · 0 评论 -
各种内排序算法的实现及性能比较
#include "1.h"int main() { List *list1,*list2,*list3,*list4,*list5,*list6; list1 = (List*)malloc(sizeof(List)); list2 = (List*)malloc(sizeof(List)); list3 = (List*)malloc(sizeof(List)); list4 =...原创 2019-06-17 22:02:07 · 1840 阅读 · 1 评论 -
有序线性表 | 对半搜索
对半搜索:当表长是奇数:那就是中间元素作为分割点。当表长是偶数:那就是中间两个元素的前一个作为分割点。即(low + high) / 2 向下取整#include <stdio.h>#include <stdlib.h>#include <iostream>using namespace std;typedef int ElemType;ty...原创 2019-06-17 21:51:49 · 1234 阅读 · 0 评论 -
优先权队列 | 最小堆 | 向上调整 | 向下调整
向下调整算法常用于创建最小堆。向上调整算法常用于在最小堆尾部插入元素后,对被破坏的最小堆结构进行修复。向上调整算法思想:向下调整算法思想:#include <stdio.h>#include <iostream>#include <stdlib.h>#include <windows.h>using namespace std...原创 2019-06-13 20:58:36 · 976 阅读 · 0 评论 -
智能交通 | 邻接矩阵 | Dijkstra | 最优路径
编写程序,实现智能交通中的最佳路径选择问题:设有n个地点,编号为0→n-1,m条路径的起点、终点和代价由用户输入提供,使用 [邻接表] 邻接矩阵为存储结构,寻找最佳路径方案(如花费时间最少,路径长度最短,交通费用最少等问题任选其一即可)为什么用的是邻接矩阵?没有为什么,看错题目了。。。。:)codeblocks中报错:‘to_string’ was not declared in this...原创 2019-06-06 21:08:02 · 1319 阅读 · 0 评论 -
邻接表为存储结构 | 实现图的深度、宽度优先遍历
关于Queue.h以及Queue.cpp的原码请参考上一篇文章。https://blog.csdn.net/weixin_41594045/article/details/90898792#include <iostream>#include <stdio.h>#include <stdlib.h>#include "Queue.h"using n...原创 2019-06-06 16:50:41 · 522 阅读 · 0 评论 -
数据结构 | 顺序栈的操作(Stack)
堆栈,简称栈。最后进栈的最先出栈。栈的两种存储结构:1、顺序栈2、链式结构堆栈#include <iostream>#include <stdlib.h>#include <windows.h>using namespace std;typedef int ElemType;//顺序栈typedef struct{ int ma...原创 2019-05-31 20:12:05 · 280 阅读 · 0 评论 -
数据结构 | 循环队列结构
队列(Queue)定义:限定在表的一端插入,在表的另一端删除的线性表。先进入队列的先出去。为了解决队列数据结构假溢出的缺陷,采用循环队列结构,把数组逻辑上看成一个头尾相连的环。#include <iostream>#include <stdlib.h>#include <windows.h>using namespace std;typede...原创 2019-05-31 22:14:51 · 704 阅读 · 0 评论 -
递归思想 | 俄罗斯套娃
递归的思想,利用了堆栈先进后出的特殊性质。进入最底层,一层一层地往外剥。【俄罗斯套娃】对于递归,最好的方法是下Breakpoint逐步跟踪变量进行研究。源代码:#include <stdio.h>#include <stdlib.h>#include <math.h>#include <iostream>using namespace...原创 2019-06-02 22:24:32 · 1944 阅读 · 0 评论 -
稀疏矩阵 | 快速转置
稀疏矩阵简介:稀疏矩阵在大规模集成电路设计、图像处理等领域应用相当广泛。何谓稀疏矩阵:简单地说,就是实际上有用的数据零星,大多数为零值的矩阵。为了节省内存,我们一般只存储非零元素。比如:上图,第一行第二列的9,我们一般用一个三元组存成<0,1,9>我们只需要申请一个三元组数组,即可将稀疏矩阵进行有效存储。稀疏矩阵结构体的定义:**稀疏矩阵的快速转置:**时间复杂度O(...原创 2019-06-03 14:53:46 · 9393 阅读 · 5 评论 -
邻接矩阵为存储结构 | 实现图的深度、宽度优先遍历
mGraph.cpp:#include <iostream>#include<stdio.h>#include<stdlib.h>#include "Queue.h"using namespace std;typedef int ElemType;typedef struct{ ElemType noEdge; ...原创 2019-06-05 10:58:47 · 989 阅读 · 0 评论 -
vscode无法在只读编辑器中输入
在设置中搜索run code config将run in terminal打勾即可。原创 2019-01-21 08:43:22 · 44765 阅读 · 22 评论 -
二叉树的先序创建、先序遍历、中序遍历、后序遍历
#include<iostream>#include<cstring>#include <stdio.h>#include<stdlib.h>using namespace std;typedef char ElementType;typedef struct BinaryTreeNode{ ElementType Dat...原创 2019-04-24 17:08:55 · 717 阅读 · 0 评论 -
顺序表的初始化、查找、插入、删除、输出、撤销
#include <stdio.h>#include <stdlib.h>#include <malloc.h>#include <time.h>#define ERROR 0#define OK 1#define Overflow 2#define Underflow 3#define NotPresent 4#define D...原创 2019-04-24 17:13:24 · 2336 阅读 · 0 评论 -
带表头结点单链表的初始化、查找、插入、删除、输出、撤销
#include <stdio.h>#include <stdlib.h>#include <malloc.h>#include <time.h>#define ERROR 0#define OK 1#define Overflow 2#define Underflow 3#define NotPresent 4#define D...原创 2019-04-24 17:15:21 · 4244 阅读 · 0 评论 -
数据结构 | 常见递归实现
递归实现对半搜索int recursion_BinSearch(ListSet L, ElemType x, int low, int high){//递归对半搜索 if(low<=high){ int mid = (low+high)/2; if(x<L.element[mid]) return recursion_B...原创 2019-06-29 14:53:23 · 278 阅读 · 0 评论