会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Erick - LONG
Be Patient! Be Positive! Be Persistence!
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
···
38
下一页
2020年4月11日
算法-图论-最短路径-Dijsktra算法
摘要: 前提不能有负权边,同样借助最小索引堆实现 #include <iostream> #include <vector> #include <stack> #include "Edge.h" #include "IndexMinHeap.h" using namespace std; template<
阅读全文
posted @ 2020-04-11 09:50 Erick-LONG
阅读(185)
评论(0)
推荐(0)
2020年4月9日
算法-图论-最小生成树-KruskalMST
摘要: 先排序,挑最小权值,并利用并查集判断不能形成环 #include <iostream> #include <vector> #include "MinHeap.h" #include "UnionFind5.h" #include "Edge.h" using namespace std; temp
阅读全文
posted @ 2020-04-09 13:37 Erick-LONG
阅读(221)
评论(0)
推荐(0)
算法-图论-最小生成树-Prim
摘要: 利用最小索引堆优化prim #include <iostream> #include <vector> #include <cassert> #include "Edge.h" #include "IndexMinHeap.h" using namespace std; template<typen
阅读全文
posted @ 2020-04-09 13:13 Erick-LONG
阅读(193)
评论(0)
推荐(0)
2020年4月6日
算法-图论-最小生成树-LazyPrim
摘要: #include "MinHeap.h" using namespace std; template<typename Graph,typename Weight> class LazyPrimMST { private: Graph &G; MinHeap<Edge<Weight>> pq;//最
阅读全文
posted @ 2020-04-06 11:37 Erick-LONG
阅读(226)
评论(0)
推荐(0)
算法-图论-有权图
摘要: 稠密图 #ifndef DENSEGRAPH_H #define DENSEGRAPH_H #include <iostream> #include <vector> #include <cassert> #include "Edge.h" using namespace std; //稠密图 --
阅读全文
posted @ 2020-04-06 10:57 Erick-LONG
阅读(324)
评论(0)
推荐(0)
2020年4月2日
算法-图的路径查询-广度优先遍历
摘要: #include <cassert> #include <vector> template<typename Graph> class ShortestPath { private: Graph &G; int s; //某一个点 bool* visited; int* from;//路径 int
阅读全文
posted @ 2020-04-02 22:05 Erick-LONG
阅读(377)
评论(0)
推荐(0)
算法-图的路径查询-深度优先遍历
摘要: #include <cassert> #include <vector> template<typename Graph> class Path { private: Graph &G; int s; //某一个点 bool* visited; int* from;//路径 void dfs(int
阅读全文
posted @ 2020-04-02 21:48 Erick-LONG
阅读(426)
评论(0)
推荐(0)
算法 -图的深度优先遍历
摘要: #ifndef COMPONENT_H #define COMPONENT_H #include <iostream> #include <cassert> using namespace std; //图的深度优先遍历 template<typename Graph> class Componen
阅读全文
posted @ 2020-04-02 21:27 Erick-LONG
阅读(341)
评论(0)
推荐(0)
算法 -- 图论
摘要: 稀疏图 #ifndef SPARSEGRAPH_H #define SPARSEGRAPH_H #include <iostream> #include <vector> #include <cassert> using namespace std; //稀疏图图 -- 邻接表 class Spar
阅读全文
posted @ 2020-04-02 13:09 Erick-LONG
阅读(152)
评论(0)
推荐(0)
2020年4月1日
算法-并查集
摘要: 查询两个节点是否连接,把两个节点相连,并查集 #ifndef UNIONFIND_UNIONFIND5_H #define UNIONFIND_UNIONFIN5_H #include <iostream> #include <cassert> using namespace std; namesp
阅读全文
posted @ 2020-04-01 22:36 Erick-LONG
阅读(180)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
···
38
下一页
公告