Disjoint-set data structure: Difference between revisions

Content deleted Content added
Dcoetzee (talk | contribs)
Added disjoint-set forests
Dcoetzee (talk | contribs)
m Rename section
Line 6:
While we could represent the sets themselves as objects and have the operations operate on these sets, the more common approach is to choose an element from each set as a ''representative''; then, '''Find''' returns the representative of the set that the given element is in, and '''Union''' takes the representatives of two given sets.
 
== LinkedDisjoint-set linked lists ==
 
Perhaps the simplest approach to creating a disjoint-set data structure is to create a [[linked list]] for each group. We choose the element at the head of the list as the representative.