**Union by Rank and Path Compression:**

O(m * (m,n)) worst case running time

(m,n) is inverse of Ackermann's function A(i,j)

(m,n) = min{i 1 A(i,
) > lg n}

**Ackermann's Function A(i,j)**

- A(1, j) = 2
^{j}for j 1 - A(i, 1) = A(i-1, 2)
for i
2

- A(i, j) = A(i-1, A(i, j-1)) for i, j 2

**Note:** A(i,j) is strictly increasing and
since m n.

Therefore A(4,
) A(4,1) = A(3,2)

A(3,2) = 2 raised to the power 2 16 times

10^{80} = the number of atoms in the observable universe

= 4 for practical uses since lg n is typically less
than 10^{80}

Thus, T(m) = O(m).

O(1) amortized cost per operation