🎙 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 5 of 10

With both path compression and union by rank, the cost of one operation is:

With both path compression and union by rank, the cost of one operation is:

  1. A.O(n)
  2. B.O(log n) in the worst case for every single call
  3. C.O(α(n)) amortised, which is at most about 4 in practice
  4. D.O(1) in the worst case for every single call
Answer & explanation

Correct answer: O(α(n)) amortised, which is at most about 4 in practice

α is the inverse Ackermann function; it grows so slowly that it is effectively constant.

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 →