next up previous
Next: Up: Previous:

Analysis

The worst case scenario is:

n = #Make-Set operations

m = #Make-Set, Union, and Find-Set operations
m = n + (q - 1) operations



T(m) = \(\Theta(n) \;+\; \sum_{i=1}^{q-1} i\)
= \(\Theta(n \;+\; q^2)\)
n = \(\Theta(m)\) and q = \(\Theta(m)\)



Therefore, T(m) = \(\Theta(m^2)\) and the amortized cost is \(\Theta(m)\)per operation.

Can we do better?


next up previous
Next: Up: Previous: