You are viewing a single comment's thread. Return to all comments →
Do we need below while loop in find(int p)? while(p !=root){ int newp = parent[p]; parent[p] = root; p = newp; } What is the purpose of this loop?
Seems like cookies are disabled on this browser, please enable them to open this website
Merging Communities
You are viewing a single comment's thread. Return to all comments →
Do we need below while loop in find(int p)? while(p !=root){ int newp = parent[p]; parent[p] = root; p = newp; } What is the purpose of this loop?