Mental Model
Union Find keeps track of groups of items that are connected. It quickly tells if two items are in the same group or not.
Analogy: Imagine a classroom where students form friend groups. Union Find helps you quickly find if two students are in the same friend group or join two groups together.
0 [parent->0] 1 [parent->1] 2 [parent->2] 3 [parent->3] 4 [parent->4] Each number is alone in its own group initially.
