Class 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DisjointSet

        public DisjointSet()
    • Method Detail

      • add

        public void add​(T o)
      • contains

        public boolean contains​(T o)
      • elements

        public java.util.Collection<T> elements()
      • find

        public T find​(T o)
      • getEquivalanceSets

        public java.util.Collection<java.util.Set<T>> getEquivalanceSets()
      • isSame

        public boolean isSame​(T x,
                              T y)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • union

        public com.complexible.common.collect.DisjointSet.Node<T> union​(T x,
                                                                        T y)