并查集

来源:互联网 发布:stylus rmx mac 编辑:程序博客网 时间:2024/06/04 08:42
非递归:
  while x<>father[x] dox:=father[x];
  exit(x);
递归
  if x<>father[x] then
   father[x]:=getfather(x);
  exit(father[x]);