|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsmithers.util.UnionFindNode
public class UnionFindNode
Implementation of a disjoint-set data structure and union-find algorithm. This class represents an individual node in a disjoint-set forest. The forest is optimised by path compression on each method call.
Constructor Summary | |
---|---|
UnionFindNode()
Creates a new node in a set of its own. |
Method Summary | |
---|---|
boolean |
sameSet(UnionFindNode node)
Tests whether this node and the given node are in the same set. |
void |
union(UnionFindNode node)
Merges the set containing this node and the set containing the given node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UnionFindNode()
Method Detail |
---|
public boolean sameSet(UnionFindNode node)
node
- the node to test against this one
true
iff both nodes are in the same setpublic void union(UnionFindNode node)
node
- a node in the set to merge with
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |