com.mhhe.clrs2e
Interface DisjointSetUnion

All Known Implementing Classes:
DisjointSetForest, DisjointSetLinkedList

public interface DisjointSetUnion

Interface for a disjoint-set-union data structure from Chapter 21 of Introduction to Algorithms, Second edition.


Method Summary
 java.lang.Object findSet(java.lang.Object x)
          Returns the object that serves as the representative of the set containing an object.
 java.lang.Object makeSet(java.lang.Object x)
          Makes a singleton set containing an object.
 void union(java.lang.Object x, java.lang.Object y)
          Unites two sets, identified by handles to objects in the sets.
 

Method Detail

makeSet

public java.lang.Object makeSet(java.lang.Object x)
Makes a singleton set containing an object.

Parameters:
x - The object in the singleton set.
Returns:
A handle that serves to identify the set in future operations.

union

public void union(java.lang.Object x,
                  java.lang.Object y)
Unites two sets, identified by handles to objects in the sets. The original sets are destroyed.

Parameters:
x - Handle to an object in one set.
y - Handle to an object in the other set.

findSet

public java.lang.Object findSet(java.lang.Object x)
Returns the object that serves as the representative of the set containing an object.

Parameters:
x - Handle to the object.
Returns:
A handle to the representative of the set containing x.