并查集
2018-11-29 00:38
120 查看
int find(int x){return x==F[x]?x:find(F[x]);} void join(int x,int y){ int fx=find(x); int fy=find(y); if(fx!=fy){ F[fy]=fx; rank[fx]+=rank[fy];// 子节点数量 } }
相关文章推荐
- 修复公路 洛谷1111 并查集 水题
- UVA 11354 BOND(并查集)
- POJ2524 并查集
- HDU 3081 Marriage Match II [二分最大流]+并查集?807★
- hdu 4496 并查集 逆向 并查集删边
- bzoj1015: [JSOI2008]星球大战starwar(并查集+倒推)
- poj 1703 Finde them, Catch them! (并查集)
- Tree(并查集)
- 【并查集】并查集专题总结
- (并查集)L2-024. 部落
- 并查集——HDOJ 1325
- hdu 2586(LCA+并查集)
- 【HDU 3038】 How Many Answers Are Wrong (带权并查集)
- 2018_2_12_Ubiquitous Religions_并查集
- 并查集
- Hduoj1272【并查集+路径压缩】
- 【NOIP2010】关押罪犯 (二分+图染色)||(贪心+并查集)
- UVa247电话圈(强联通分量--传递闭包+并查集 or tarjan算法)
- 并查集_2
- hdu 1272 小希的迷宫(利用树的性质和并查集判断树)