I have an understanding of the algorithm in this way...
path compression helps lower time for find operation and overtime the time complexity for path compression averages out to be O(1).
we decide which of the two is a parent node (during union operation) looking at the rank.
But I never could understand what union by rank does, tbh I don't believe I correctly understand what rank means here. I also don't understand why, during union, rank of parent is incremented by 1 if rank of the two sets to be unioned are same.