next up previous
Next: Up: Previous:

Analysis

Union by Rank and Path Compression:

O(m * $\alpha$(m,n)) worst case running time

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

$\alpha$(m,n) = min{i $\geq$ 1 $\mid$ A(i, \(\lfloor \frac{m}{n}
\rfloor\)) > lg n}

Ackermann's Function A(i,j)



\psfig{figure=figures/f15-1.ps}

Note: A(i,j) is strictly increasing and \(\lfloor \frac{m}{n} \rfloor
\;\geq\; 1\) since m $\geq$ n.

Therefore A(4, \(\lfloor \frac{m}{n}
\rfloor\)) $\geq$ A(4,1) = A(3,2)

A(3,2) = 2 raised to the power 2 16 times \(>> \;10^{80}\)

1080 = the number of atoms in the observable universe

\(\alpha(m,n)\) = 4 for practical uses since lg n is typically less than 1080

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

O(1) amortized cost per operation


next up previous
Next: Up: Previous: