Merge a and b using rank compression
if ( r1 != r2 ) : NEW_LINE INDENT if ( Rank [ r1 ] > Rank [ r2 ] ) : NEW_LINE INDENT parent [ r2 ] = r1 NEW_LINE Rank [ r1 ] += Rank [ r2 ] NEW_LINE DEDENT else : NEW_LINE INDENT parent [ r1 ] = r2 NEW_LINE Rank [ r2 ] += Rank [ r1 ] NEW_LINE DEDENT DEDENT