Class IntegerUnionFind


  • public class IntegerUnionFind
    extends Object
    An implementation of Tarjan's union-find, using path compression and balancing, for non-negative integers
    • 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()