the disjoint sets class /*construct the disjoint sets object numelements is the initial number of disjoint sets *disjsets::disjsetsint numelements snumelements figure disjoint sets initialization routine /*union two disjoint sets for simplicitywe assume root and root are distinct and represent set names root is the root of set root is the root of set *void disjsets::unionsetsint root int root sroot root figure union (not the best way /*perform find error checks omitted again for simplicity return the set containing *int disjsets::findint const ifsx return xelse return findsx )figure simple disjoint sets find algorithm be supported simultaneously the mutator is always calledunless the controlling object is unmodifiable the average-case analysis is quite hard to do the least of the problems is that the answer depends on how to define average (with respect to the union operationfor instancein the forest in figure we could say that since there are five treesthere are * equally likely results of the next union (as any two different trees can be unioned