🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Deletes elements that are no longer needed
  2. B.Sorts the parent array
  3. C.Merges the two smallest sets
  4. 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 →