DSA Studio
Search
Home
Sign in
Union-Find Checkpoint
Disjoint sets, path compression, and applications.
1. Path compression in Union-Find does what?
Makes nodes point directly to root during find
Sorts the elements
Doubles the tree size
Removes nodes
2. If Union returns false, it means:
Elements were already in the same set
Union failed due to error
Elements are in different sets
The set is empty
3. Time complexity of Find with path compression is:
4. To detect a cycle when adding edges, check if Union returns:
false
true
null
the root
5. Union by rank attaches the _____ tree under the _____ tree:
Submit quiz
Auto-advance on pass