as to which node is set to be the root for the combined tree in the case of equivalence pair (eg)the root of is while the root of is because is the root of the larger treenode is set to point to not all equivalences will combine two trees if edge (fgis processed when the representation is in the state shown in figure ( )no change will be made because is already the root for the weighted union rule helps to minimize the depth of the treebut we can do better than this path compression is method that tends to create extremely shallow trees path compression takes place while finding the root for given node call this root path compression resets the parent of every node on the path from to to point directly to this can be implemented by first finding second pass is then made along the path from to rassigning the parent field of each node encountered to alternativelya recursive algorithm can be implemented as follows this version of find not only returns the root of the current nodebut also makes all ancestors of the current node point to the root public integer find(integer currif (array[curr=nullreturn curr/at root array[currfind(array[curr])return array[curr]example figure (dshows the result of processing equivalence pair (heon the the representation shown in figure (cusing the standard weighted union rule without path compression figure illustrates the path compression process for the same equivalence pair after locating the root for node hwe can perform path compression to make point directly to root object likewisee is set to point directly to its rootf finallyobject is set to point to root object note that path compression takes place during the find operationnot during the merge operation in figure this means that nodes bcand have node remain as their parentrather than changing their parent to be while we might prefer to have these nodes point to fto accomplish this would require that additional information from the find operation be passed back to the union operation this would not be practical path compression keeps the cost of each find operation very close to constant to be more precise about what is meant by "very close to constant,the cost of path compression for find operations on nodes (when combined with the weighted