并查集
Annmike
ACM
展开
-
并查集
并查集最主要的是查找元素是否在同一棵树上,或者看看所给的元素分布在几棵树上。最主要的是两个函数一个是寻找根节点的函数,另一个则是压缩路径的函数,根节点有一定的特性,根节点的数等于它本身。附上两个最基本的函数:1.寻找根节点的函数;int findd(int x){ if(a[x]==x) return x; else retu...原创 2018-01-24 20:13:54 · 168 阅读 · 0 评论 -
Wireless Network 并查集
An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the n...原创 2018-01-24 20:34:58 · 208 阅读 · 0 评论