Content deleted Content added
m sets->groups in second para |
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}}
|