Union Find Set Algorithm

Zhiyuan Xu Lv1
1
2
3
4
5
6
7
8
9
namespace UFS{
int n,m,t,pos[MAXN],k,a,b,c,fa[MAXN];
inline int find(int x){
return x==fa[x] ? x : fa[x] = find(fa[x]);
}
inline void Union(int x, int y){
fa[find(x)] = find(y);
}
}
  • Title: Union Find Set Algorithm
  • Author: Zhiyuan Xu
  • Created at : 2024-07-06 00:23:55
  • Updated at : 2024-07-06 00:24:13
  • Link: https://redefine.ohevan.com/Template/UFS/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v3.2.2