Jan 14, 2021
Thank you for this article. It has finally demystified Disjoint Sets for me.
Just a doubt, I think on this line shouldn't it be (leaderOfY, leaderOfX) instead of (y,x).
If we use (y, x), y leaves its previous set and joins the set of x alone, instead of a union of sets x and y.