Class SequentialDisjointSetStruct

    • Constructor Detail

      • SequentialDisjointSetStruct

        public SequentialDisjointSetStruct()
        Deprecated.
    • Method Detail

      • union

        public void union​(long p,
                          long q)
        Deprecated.
        Description copied from interface: DisjointSetStruct
        Joins the set of p (Sp) with set of q (Sq).
        Specified by:
        union in interface DisjointSetStruct
        Parameters:
        p - an item of Sp
        q - an item of Sq
      • find

        public abstract long find​(long nodeId)
        Deprecated.
        Find set Id of element p. Note that implementations of this method might apply path optimizations while looking for the set id.
        Parameters:
        nodeId - the element in the set we are looking for
        Returns:
        an id of the set it belongs to
      • findAndBalance

        public final long findAndBalance​(long p)
        Deprecated.
        Find set id of element p and balances the tree structure while searching.

        This default implementation uses recursive path compression logic.

        Parameters:
        p - the set element
        Returns:
        returns the representative member of the set to which p belongs
      • sameSet

        public final boolean sameSet​(long p,
                                     long q)
        Deprecated.
        Description copied from interface: DisjointSetStruct
        Check if p and q belong to the same set.
        Specified by:
        sameSet in interface DisjointSetStruct
        Parameters:
        p - a set item
        q - a set item
        Returns:
        true if both items belong to the same set, false otherwise