图算法
文章平均质量分 74
吴钩揽月
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Floyd_Warshall Algorithm
本算法是对算法导论上相关章节伪代码的实现: #include #include #include using namespace std; #define MAX 32767 ifstream fin("data.in"); int N,M; int u,v,l; int D[1000][1000],p[1000][1000],tmpD[1000][1000],tmpP[1000][1000原创 2014-12-27 16:08:13 · 636 阅读 · 0 评论 -
Shortest paths and matrix multiplication
本算法是对<算法导论>第25章第一节的实现 有三个版本: 第一个,普通版本: //SLOW-ALL-PAIRS-SHORTEST-PATHS #include using namespace std; #define MAX 32767 int N,M; int u,v,l; int W[1000][1000],Q[1000][1000],tmp[1000][1000]; void p原创 2014-12-26 16:19:48 · 634 阅读 · 0 评论 -
Single-source shortest paths in directed graphs
此算法为<算法导论>中第24章第2小节关于single-source shortest paths in directed graphs原理的实现. 原著P592 #include using namespace std; #define MAX 32767 int N,M; int u,v,l,pos; int w[1000][1000],d[1000]; int order[1000]原创 2014-12-22 17:21:57 · 626 阅读 · 0 评论 -
Kruskal算法
算法导论第23章第2节 #include #include using namespace std; struct node{ node(int i,int j,int l):x(i),y(j),len(l){} int x; int y; int len; }; int N,M; int u,v,l; node* length[1000]; int p[1000]; int cnt原创 2014-12-28 15:28:21 · 665 阅读 · 0 评论 -
Prim算法
本算法是对《算法导论》相关章节伪代码的实现: 这是第一次写的: #include #include #include #include using namespace std; #define MAX 32767 ifstream fin("data.in"); struct node { node(int x1,int y1,int len1):x(x1),y(y1),len(原创 2015-01-04 15:38:28 · 646 阅读 · 0 评论
分享