@@ -0,0 +1,914 @@
+package unionfind;%0A%0A/**%0A * @author Alexis Giraudet%0A */%0Apublic class MakeSetTree%3CK extends Comparable%3CK%3E%3E%7B%0A%0A    protected MakeSetTree%3CK%3E _parent;%0A    protected final K _key;%0A    protected int _rank;%0A%0A    public MakeSetTree(K ka)%7B%0A        _key = ka;%0A        _parent = null;%0A        _rank = 0;%0A    %7D%0A%0A%0A    public void union(MakeSetTree%3CK%3E set) %7B%0A        MakeSetTree%3CK%3E xRep = this.find();%0A        MakeSetTree%3CK%3E yRep = set.find();%0A%0A        if(xRep != yRep)%7B%0A            if(xRep._rank %3C yRep._rank)%7B%0A                xRep._parent = yRep;%0A            %7D%0A            else if(xRep._rank %3E yRep._rank)%7B%0A                yRep._parent = xRep;%0A            %7D%0A            else%7B%0A                yRep._parent = xRep;%0A                xRep._rank++;%0A            %7D%0A        %7D%0A%0A    %7D%0A%0A    public MakeSetTree%3CK%3E find() %7B%0A        if(this._parent != null)%0A            this._parent = this._parent.find();%0A        return this._parent;%0A    %7D%0A%7D%0A

create makeset FH