
数据结构
kikook
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【c++】约瑟夫环问题的链表实现
c++语言&使用一二级指针、单链表解决约瑟夫环问题原创 2017-11-27 13:35:11 · 2181 阅读 · 0 评论 -
[C++]八大排序1M数据实测速度比较
耗时6.35小时,1M数据量实测,快排果然是最快的,//2018/1/5 发现希尔排序慢的有点过分,可能写得有问题,期末考完了改一下重新测原创 2019-01-04 23:12:18 · 653 阅读 · 0 评论 -
图知识小结6-十字链表的数组实现与应用
十字链表是一种高效存储稀疏图并可以显著提高查找效率的一种存储结构,解决了图的遍历过程中邻接表空间消耗大而邻接矩阵求一个点入度又需要遍历全部表的问题,下面给出其数组实现://十字链表的数组实现 #include <bits/stdc++.h>using namespace std;const int MAX_EDGE = 10000;const int MAX_VER...原创 2018-12-11 12:19:12 · 389 阅读 · 0 评论 -
图知识小结6-DFS应用【CCF201709-4通信网络】
#include <bits/stdc++.h>using namespace std;const int MAX_EDGE = 10005;const int MAX_VERTICES = 1005;int conn[MAX_VERTICES][MAX_VERTICES]; //记录两个点之间的连通性质 struct Edge{ int v, last;} edge[...原创 2018-12-09 23:38:46 · 460 阅读 · 0 评论 -
【C++】CCF 201703-4 地铁修建 【从80分到100分的优化过程】
#include <bits/stdc++.h>using namespace std;const int MAX_EDGE = 200005;const int MAX_VERTICES = 100005;struct Edge{ int v, len, last;} edge[2 * MAX_EDGE]; //开始是80分,后来改了一下就对了,原因是无向图的边集上限...原创 2018-12-07 18:07:57 · 507 阅读 · 0 评论 -
图论知识小结4-Dijkstra的数组模拟实现
#include <bits/stdc++.h>using namespace std;const int MAX_EDGE = 10000;const int MAX_VERTICES = 100;struct Edge{ int len, v, last;} edgem[MAX_EDGE];int latest_edge_of_u[MAX_VERTICES];in...原创 2018-12-06 19:27:36 · 240 阅读 · 0 评论 -
图论知识小结3-BFS的数组模拟实现
#include <bits/stdc++.h>using namespace std;const int MAX_EDGE = 10000;const int MAX_VERTICES = 100;struct Edge{ int len, v, last;} edge[MAX_EDGE];int eid;bool vst[MAX_VERTICES];int la...原创 2018-12-06 17:48:28 · 253 阅读 · 0 评论 -
图论知识小结2-DFS的数组模拟实现
#include <bits/stdc++.h>using namespace std;const int MAX_EDGE = 10000;const int MAX_VERTICES = 100;struct Edge{ int len, v, last;} edge[MAX_EDGE];bool vst[MAX_VERTICES];int latest_edge...原创 2018-12-06 17:32:31 · 267 阅读 · 0 评论 -
图论知识小结1-使用数组模拟实现邻接表
//普通一维数组模拟实现const int MAX_N = 100;const int MAX_M = 10000;//建立MAX_N条边 struct edge{ int v; //当前边的终点 int last_eid; //上一条相同起点的边的编号 }edge[MAX_M]; int latest_eid_of_u[MAX_N], temp_eid; void ini...原创 2018-12-09 23:35:24 · 336 阅读 · 0 评论 -
图知识小结5-kruskal算法的数组模拟实现与应用
#include <bits/stdc++.h>using namespace std;const int MAX_EDGE = 100000;const int MAX_VERTICES = 100;struct Edge{ int len, u, v;} edge[MAX_VERTICES];int fa[MAX_VERTICES], nv, ne;bool cm...原创 2018-12-08 17:15:06 · 210 阅读 · 0 评论 -
排序知识点小结1-手写堆排序及STL实现
首先是造轮子:// maximum heap based on integer type#include <bits/stdc++.h>using namespace std;const int MAX_SIZE = 100000;int heap[MAX_SIZE], result[MAX_SIZE];int size;void init(){ memset(h...原创 2018-12-07 18:03:47 · 324 阅读 · 0 评论 -
【c++】指针自动改变的问题(已解决)
写了一年多的C ++了,今天写二叉搜索树ADT中的deletemin()的时候出现了一个非常奇怪,从未见过的问题---指针在赋值给其他指针变量一次之后,自己自动的改变了,简直是吓死我了排查这个问题用了一个多小时,通过调试和输出过程量,最后确定了就是在这个deletemin()函数中许多指针在赋值之后都会自动跳变,完全失去了控制:Node* BST :: deletemin(Node*&a...原创 2018-11-13 20:22:14 · 3119 阅读 · 2 评论 -
【C++】Pascal的旅行
一块的nxn游戏板上填充着整数,每个方格上为一个非负整数。目标是沿着从左上角到右下角的任何合法路径行进,方格中的整数决定离开该位置的距离有多大,所有步骤必须向右或向下。请注意,0是一个死胡同。 图1所示的4 x 4板,其中实心圆标识起始位置,虚线圆标识目标,图2显示了从开始到目标的三个路径。原创 2018-01-01 22:11:32 · 642 阅读 · 0 评论 -
[C++]kruaskal的伪代码描述
既然给出了prim的,就顺便写一下Kruskal的伪代码描述:struct Edge{ int u, v, w; //u for starting point, v for end point, w for weight Edge(int u, int v, int w){ this->u = u; this->v = v; this->w = w; }...原创 2019-01-08 22:22:25 · 1079 阅读 · 0 评论