Mental Model
Union Find keeps track of which items belong together in groups without overlap. 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 out 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]
