void union(int x,int y)
{
int super_parent_x=get_superparent(x);
int super_parent_y=get_superparent(y);
if (super_parent_x!=super_parent_y)
{
par[super_parent_x]=super_parent_y;
}
}
We had to connect x and y, but according to the code written in this video it is connecting superparent of x and superparent of y…
Why is he connecting superparent of x and superparent of y instead of simply connecting x and y ??