To analyze the amortized cost of the ith TableInsert operation, let

*num*_{i} denote the number of items stored in the table after the ith
operation

*size*_{i} denote the total size of the table after the ith operation

denote the potential after the ith operation

Initially, *num*_{0} = 0, *size*_{0} = 0, and = 0.

Consider two cases based on whether a table expansion is done.

No expansion:

= 1 + (2**num*_{i}-*size*_{i}) - (2**num*_{i-1} -
*size*_{i-1})

= 1 + (2**num*_{i}-*size*_{i}) - (2*(*num*_{i} - 1) - *size*_{i})

= 1 - (-2) = 3