Union Find Flashcards
1
Q
What is Union-Find?
A
Data structure for disjoint sets.
2
Q
How does the ‘path compression’ technique optimize Union-Find?
A
Flattens tree for faster lookups.
3
Q
What is the difference between union by rank and union by size?
A
Optimizes merges to keep trees short.
4
Q
How does Union-Find help in cycle detection?
A
Use Union-Find to check if nodes are already connected.
5
Q
A