Mental Model
Path compression makes finding the leader of a group faster by making every node on the path point directly to the leader.
Analogy: Imagine a family tree where each person points to their parent. Path compression is like updating everyone in the chain to point directly to the oldest ancestor, so future lookups are quicker.
1 -> 2 -> 3 -> 4 -> null ā start (find 1) After path compression: 1 -> 4 2 -> 4 3 -> 4 4 -> null
