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 to flatten the structure.
