Union Find Flashcards

1
Q

What is Union-Find?

A

Data structure for disjoint sets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does the ‘path compression’ technique optimize Union-Find?

A

Flattens tree for faster lookups.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the difference between union by rank and union by size?

A

Optimizes merges to keep trees short.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does Union-Find help in cycle detection?

A

Use Union-Find to check if nodes are already connected.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly