Trivia ForgePlay free →

In a Disjoint Set Union (DSU) data structure, what is the nearly-constant time complexity achieved by using both union-by-rank and path compression?

Show answer

O(α(n))

The function α(n) is the inverse Ackermann function, which grows extremely slowly; for all practical values of n, α(n) is less than 5. This makes DSU operations effectively constant time in practice.

Also asked as:
  • What is the amortized time complexity per DSU operation when both path compression and union-by-rank are implemented?

Would you remember this in 6 months?

Trivia Forge uses spaced repetition so facts stick. Free, no signup needed.

Turn on Algorithms practice →

More Algorithms trivia

See all 83 →