Let \(R\) be an equivalence relation on the students in this class, where \((s,t) \in R\)
if \(s\) and \(t\) have the same favorite among {AC, FN, FB, TR, CC, CR, PMC, ____}.
Operations we’d like to facilitate:
Find(4)
Find(4) == Find(8)
if (Find(7) != Find(2)) Union(Find(7), Find(2))
Disjoint Sets ADT
We will implement a data structure in support of “Disjoint Sets”:
Maintains a collection \(S = \{s_0, s_1, \ldots, s_k\}\) of disjoint sets
Relevant result: In an upTree implementation of Disjoint Sets using
smart Union and Find with path compression, any sequence of \(m\)Union
and Find operations results in worst case running time of \(O(\_\_\_\_\_\_\_\_\_\_)\),
where \(n\) is the number of items.