Disjoint-set data structure: Difference between revisions

Content deleted Content added
Dcoetzee (talk | contribs)
m sets->groups in second para
Dcoetzee (talk | contribs)
m +of
Line 18:
== Disjoint-set forests ==
 
In a disjoint-set forest, each set is represented by a [[tree data structure]] where each node holds a [[reference]] to its parent node. The representative of each set is the root of that set's tree. '''Find''' simply follows parent nodes until it reaches the root. '''Union''' combines two trees into one by making the root of one of them the child of the root of the other. One way of implementing these might be:
 
{{wikicode}}