**fig8_13.txt** /* 1*/ // Union two disjoint sets using the height heuristic. /* 2*/ // For simplicity, we assume Root1 and Root2 are distinct. /* 3*/ // And represent set names. /* 4*/ void /* 5*/ Disj_Sets:: /* 6*/ Union_By_Height( unsigned int Root1, unsigned int Root2 ) /* 7*/ { /* 8*/ if( S_Array[ Root2 ] < S_Array[ Root1 ] ) // Root2 is deeper. /* 9*/ S_Array[ Root1 ] = Root2; // Make root2 new root. /*10*/ else /*11*/ { /*12*/ if( S_Array[ Root1 ] == S_Array[ Root2 ] ) /*13*/ S_Array[ Root1 ]--; // Update height if same. /*14*/ S_Array[ Root2 ] = Root1; // Make root1 new root. /*15*/ } /*16*/ }