Find the representing element for d
.
Find the representing element for d
. Two
elements belong to the same set iff they have the same
representative.
Check whether an element is already present in the forest.
Iterator over all elements of this forest.
Add a new element to the forest.
Add a new element to the forest; the operation has no effect if the element is already present in the forest.
Iterator over the elements representing sets; exactly one object will be enumerated for each set.
Join two sets.
(Since version ) see corresponding Javadoc for more information.
A simple, textbook implementation of a union-find data structure.