Package com.complexible.common.collect
Class DisjointSet<T>
- java.lang.Object
-
- com.complexible.common.collect.DisjointSet<T>
-
public class DisjointSet<T> extends java.lang.Object
Disjoint set data structure. A disjoint set Uses path compression and union by rank.- Author:
- Evren Sirin
-
-
Constructor Summary
Constructors Constructor Description DisjointSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T o)
boolean
contains(T o)
java.util.Collection<T>
elements()
T
find(T o)
java.util.Collection<java.util.Set<T>>
getEquivalanceSets()
boolean
isSame(T x, T y)
java.lang.String
toString()
com.complexible.common.collect.DisjointSet.Node<T>
union(T x, T y)
-
-
-
Method Detail
-
add
public void add(T o)
-
contains
public boolean contains(T o)
-
elements
public java.util.Collection<T> elements()
-
getEquivalanceSets
public java.util.Collection<java.util.Set<T>> getEquivalanceSets()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-