Concept Flow - Union Find Disjoint Set Data Structure
Initialize each element as its own set
Find root of element A
Find root of element B
Are roots different?
No→Sets already united
Yes
Union: Attach one root to another
Update parent pointers
Sets merged
Start with each element separate. To union, find roots of both elements. If roots differ, link one root to the other to merge sets.
