我正在研究通过等级和路径压缩并集的不相交算法。
我很清楚如果Union by rank使用那么find() operation复杂性是O(log(n))。
Union by rank
find() operation
O(log(n))
但我想知道complexity of the path compression technique如果我使用按等级并集或不使用按等级并集,不相交集算法是什么?
complexity of the path compression technique
algorithm disjoint-sets union-find
如果我们知道最后一个元素,则可以在O(1)时间内连接两个链表。那么,有没有办法C++使用内置数据结构来连接两个List,或者我必须自己实现链接列表然后使用它?
C++
c++ data-structures
algorithm ×1
c++ ×1
data-structures ×1
disjoint-sets ×1
union-find ×1