03 2021 档案

摘要:/** 图论之最短路径 Floyd算法 */ #include<stdio.h> #include<string.h> #include<algorithm> #define INF 0x3f3f3f int g[100][100]; void Floyd(int n) { for(int k=0; 阅读全文
posted @ 2021-03-08 21:33 永恒& 阅读(77) 评论(0) 推荐(0)
摘要:/** 图论之最短路径Dijkstra算法 */ #include<string.h> #include<stdio.h> #include<vector> #include<queue> using namespace std; const int MAXN = 200; const int IN 阅读全文
posted @ 2021-03-08 19:57 永恒& 阅读(109) 评论(0) 推荐(0)
摘要:/** 图论算法 最小生成树Kruskal 时间复杂度 O(ElogE) Prim 时间复杂度 O(V2) */ #include<stdio.h> #include<vector> #include<queue> #include<algorithm> using namespace std; c 阅读全文
posted @ 2021-03-07 22:36 永恒& 阅读(83) 评论(0) 推荐(0)
摘要:/** 图论算法 遍历 */ #include<stdio.h> #include<vector> #include<queue> using namespace std; int g[100][100];//邻接矩阵表示法,0代表无边,1代表右边 int visit[100];//0代表没遍历,1 阅读全文
posted @ 2021-03-07 21:31 永恒& 阅读(80) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<stdlib.h> #include<queue> struct TNode//树的节点 { int data; struct TNode *l,*r; }; TNode* Create()//建树 { char ch; scanf("%c",& 阅读全文
posted @ 2021-03-07 20:12 永恒& 阅读(43) 评论(0) 推荐(0)