【问题标题】:What is the complexity of path compression technique for disjoint set algorithm?不相交集算法的路径压缩技术的复杂性是多少?
【发布时间】:2019-05-21 00:46:24
【问题描述】:

我正在研究disjoint algorithm with the union by rank and path compression

我很清楚如果使用Union by rank,那么find() operation 的复杂度就是O(log(n))

但我想知道如果我使用按等级联合还是不使用按等级联合,不相交集算法的complexity of the path compression technique 是什么?

【问题讨论】:

    标签: algorithm disjoint-sets union-find


    【解决方案1】:

    如果您将集合任意链接在一起,而不是使用 union-by-rank 或 union-by-size,那么单独的路径压缩将实现 O(m log n) 时间的任何序列em>n 个联合和 m 查找(m > n)。这使得查找操作的摊销成本O(log n)

    证明很困难,所以这里有一个很好的确认参考:https://www.cs.princeton.edu/courses/archive/spring13/cos423/lectures/UnionFind.pdf

    【讨论】:

      猜你喜欢
      • 2013-12-14
      • 2013-08-31
      • 2017-08-10
      • 2017-11-07
      • 1970-01-01
      • 2012-07-08
      • 1970-01-01
      • 1970-01-01
      • 2016-11-28
      相关资源
      最近更新 更多