What is the role of 'union by rank' in Union-Find?
Union by rank is used to keep the tree flat by always attaching the smaller tree (in terms of rank) under the larger tree, which ensures better performance for future operations.
Thatâ€™s correct. Union by rank helps prevent the tree from becoming too deep, which improves the efficiency of subsequent operations.
Can you explain how rank is determined and how it affects the performance of 'union' operations?