What is 'Path Compression' in DSU?
What is 'Path Compression' in DSU?
Approach: Describe flattening the tree structure during Find operations.
An optimization for Union-Find where every node on the path to the root is made a direct child of the root during a Find operation, significantly speeding up future operations.
Follow-up: What is the other common optimization for DSU? (Union by rank)
Key concepts: optimization, tree height.