Concept Flow - Union Find Disjoint Set Data Structure
[Initialize each element as its own set]
|
v
[Find root of element A] ←─┐
| |
v |
[Find root of element B] ──┘
|
v
[Are roots different?] --No--> [Do nothing]
|
Yes
|
v
[Union sets by linking roots]
|
v
[Update parent pointers]
|
v
[Done]Start with each element alone. To union, find roots of both elements. If roots differ, link one root to the other to merge sets.
