What is the amortized time complexity of a 'Find-Set' operation when using both path compression and union-by-rank heuristics?
Show answer
O(alpha(n))
The function alpha(n) is the inverse Ackermann function, which grows extremely slowly. For all practical values of n, this complexity is effectively constant (less than 5).
Also asked as:
- When path compression and union-by-rank heuristics are both applied, what is the amortized complexity of a 'Find-Set' operation?