public class DisjointSet<T>
extends java.lang.Object
Constructor and Description |
---|
DisjointSet(java.util.Collection<T> items)
This performs the make-set operation described in
CLRS on all items
in the collection
|
public T findSet(T item)
item
- item whose set is to be determinedpublic boolean union(T x, T y)
x
- member of a disjoint set (unknown whether or not the same set as y)y
- member of a disjoint set (unknown whether or not the same set as x)