Class IntegerUnionFind


  • public class IntegerUnionFind
    extends java.lang.Object
    An implementation of Tarjan's union-find, using path compression and balancing, for non-negative integers
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int find​(int x)  
      int size()  
      void union​(int x, int y)
      union the equiv classes of x and y
      • Methods inherited from class java.lang.Object

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

      • IntegerUnionFind

        public IntegerUnionFind()
      • IntegerUnionFind

        public IntegerUnionFind​(int size)
        Parameters:
        size - initial size of the tables
    • Method Detail

      • union

        public void union​(int x,
                          int y)
        union the equiv classes of x and y
      • find

        public int find​(int x)
        Parameters:
        x -
        Returns:
        representative of x's equivalence class
      • size

        public int size()