Mental Model
Union Find keeps track of which items belong together in groups without mixing them up. It helps quickly find if two items are in the same group.
Analogy: Imagine a classroom where students form friend groups. Each student knows who their group leader is. When two groups become friends, their leaders join, making one bigger group.
1 -> 1 2 -> 2 3 -> 3 4 -> 4 5 -> 5 Each number points to itself as its own group leader.
