您当前的位置: 首页 >  数据结构与算法

星拱北辰

暂无认证

  • 0浏览

    0关注

    1205博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

【数据结构与算法】非森林版并查集V2.1的Java实现

星拱北辰 发布时间:2020-02-23 15:44:06 ,浏览量:0

非森林版查集

并查集V1.1不使用联合启发式或路径压缩算法,新版本采用同样的基本思路,但使用了按等级和路径压缩的并集。

核心功能
  • void union(root1, root2) → Merge two sets
  • int find(x) → Return set containing x
编程实现
/**
 * Disjoint set class, using union by rank and path compression.
 * Elements in the set are numbered starting at 0.
 */
public class DisjSets {
   

    private int [] set;

    /**
     * Construct the d
关注
打赏
1660750074
查看更多评论
立即登录/注册

微信扫码登录

0.0401s