next up previous
Next: Up: Previous:

Aggregate Method

T(n) is the worst case time for n calls
= \(\sum_{i=0}^{\lfloor lg n \rfloor} n/2^i \)
= \(n \sum_{i=0}^{\lfloor lg n \rfloor} 1/2^i
\;<\; n \sum_{i=0}^{\infty} 1/2^i \)
= \(n(\frac{1}{1 - 1/2}\))
= 2n
T(n) = O(n)



The amortized cost of each call is thus O(n)/n = O(1).


next up previous
Next: Up: Previous: