摘要: http://poj.org/problem?id=1611并查集的基本应用题View Code 1 #include <stdio.h> 2 #include <stdlib.h> 3 int father[30005],num[30005]; 4 5 void make_set(int x) 6 { 7 father[x] = x; 8 num[x] = 1; 9 }10 11 //查找x元素所在的集合,回溯时压缩路径12 int find_set(int x)13 {14 if(x != father[x])15 {16 father[x] = find_set( 阅读全文
posted @ 2011-07-20 18:25 zhangteng 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996) 二.图算法: (1)图的深度优先遍历和广度优先遍历. (2)最短路径算法(dijkstra,bellman-ford,floyd,heap+dijkstra) (poj1860,poj3259,poj1062,poj2253,poj1125,poj2240) (3)最小生成树算法(prim,kr 阅读全文
posted @ 2011-07-20 09:53 zhangteng 阅读(347) 评论(0) 推荐(0) 编辑