structurebut we add the following simple heuristics to make it run fasterunion-by-sizestorewith each position node pthe size of the subtree rooted at in union operationmake the tree of the smaller set become subtree of the other treeand update the size field of the root of the resulting tree path compressionin find operationfor each node that the find visitsreset the parent pointer from to point to the root (see figure these heuristics increase the running time of an operation by constant factorbut as we discuss belowthey significantly improve the amortized running time figure path-compression heuristic(apath traversed by operation find on element (brestructured tree