1

For amortized analysis (aggregate method), dynamic table insertion cost can be divided into:

if no expansion, then cost = 1 if we expand the table, then cost = i (if i-1 is an exact power of 2)

then the total cost is total cost

I don't understand how to get 2n from the part that I circle below why

ryan chandra
  • 123
  • 4

1 Answers1

0

It should be an inequality, using the formula for the sum of a geometric series: $$ \sum_{j=0}^m 2^j = 2^{m+1} - 1. $$ Substituting $m = \lg n$ gives $$ \sum_{j=0}^{\lg n} 2^j = 2^{\lg n+1} - 1 = 2n-1. $$

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514