← Quiz: Union-Find (Disjoint Set Union): all 10 questions
Quiz: Union-Find (Disjoint Set Union) · Question 3 of 10
What does path compression do?
What does path compression do?
- A.Deletes elements that are no longer needed
- B.Sorts the parent array
- C.Merges the two smallest sets
- D.During find, points every node on the path directly to the root
Answer & explanation
Correct answer: During find, points every node on the path directly to the root
The next find on any of those nodes then takes a single step.
Can you get the rest right without peeking?
Take the timed Quiz: Union-Find (Disjoint Set Union) quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →