Concept Flow - Path Compression in Union Find
Start: Find(x)
Is parent[x
No
Recursively Find parent[x
Set parent[x
Return root
The find operation checks if a node is its own parent. If not, it recursively finds the root and updates the node's parent to the root, compressing the path.
