摘要:
//解题思路:最小生成树Prim算法实现,注意将已修建的路的距离置为0#include <stdio.h>#include <string.h>#define arraysize 101int maxData = 0x7fffffff;int dis[arraysize][arraysize];bool final[arraysize];int d[arraysize];i... 阅读全文
posted @ 2010-04-30 22:28
北海小龙
阅读(284)
评论(0)
推荐(0)
摘要:
//最小生成树求生成树中的最大边,使用Kruskal算法//总结:re错误为开的数组太小#include <stdio.h>#include <algorithm>using namespace std;#define nodesize 2001#define edgesize 10001typedef struct node{int v;//起点int u;//终点__i... 阅读全文
posted @ 2010-04-30 22:27
北海小龙
阅读(253)
评论(0)
推荐(0)
摘要:
//题目大意:最大生成树//解题思路:在排序的时候按从大到小排即可,其余与Kruskal算法一样//注意:如果使用Prime算法注意考虑重边的情况,Kruskal算法不必考虑重边的情况(因为是将边进行排序,当一条边已经加入的时候,不可能加入重边)#include <stdio.h>#include <algorithm>using namespace std;#define... 阅读全文
posted @ 2010-04-30 22:27
北海小龙
阅读(299)
评论(0)
推荐(0)
摘要:
//最小生成树:Kruskal算法#include <stdio.h>#include <algorithm>using namespace std;#define arraysize 15001#define nodenum 1001typedef struct node{int start;//起点int end;//终点int w;//费用};node edges[a... 阅读全文
posted @ 2010-04-30 22:26
北海小龙
阅读(240)
评论(0)
推荐(0)
浙公网安备 33010602011771号