Union-Find Disjoint Set (UFDS)
UFDS is a straightforward but powerful data structure often used to determine when data is in the same set as one another
Last updated
UFDS is a straightforward but powerful data structure often used to determine when data is in the same set as one another
Last updated
Quick Find
O(1)
O(n)
Quick Union
O(n)
O(n)
Weighted union (union by rank)
O(log n)
O(log n)
Path compression
O(log n)
O(log n)
Weighted union + path compression
a(m, n)
a(m, n)