The same doubling array, but instead of averaging after the fact, define a potential: phi = 2 x size - capacity, the credit the array has saved up. Each append is charged its real cost plus the change in phi. Cheap appends raise phi by 2, so they overpay. The copy at a resize is paid for by the drop in phi it causes. The claim to check: every append costs the same amortized amount, whatever its real cost.
Potential method on twelve appends to a doubling array.
Append 1: real cost 1. phi goes from 0 to 2 x 1 - 1 = 1, a change of 1. Amortized cost = 1 + (1) = 2.
Append 1: cost 1, phi 1, amortized 2.
Append 2: real cost 2, a resize that copies 1 elements. phi goes from 1 to 2 x 2 - 2 = 2, a change of 1. Amortized cost = 2 + (1) = 3.
Append 2: cost 2, phi 2, amortized 3.
Append 3: real cost 3, a resize that copies 2 elements. phi goes from 2 to 2 x 3 - 4 = 2, a change of 0. Amortized cost = 3 + (0) = 3.
Append 3: cost 3, phi 2, amortized 3.
Append 4: real cost 1. phi goes from 2 to 2 x 4 - 4 = 4, a change of 2. Amortized cost = 1 + (2) = 3.
Append 4: cost 1, phi 4, amortized 3.
Append 5: real cost 5, a resize that copies 4 elements. phi goes from 4 to 2 x 5 - 8 = 2, a change of -2. Amortized cost = 5 + (-2) = 3. The saved-up credit pays for the copy.
Append 5: cost 5, phi 2, amortized 3.
Append 6: real cost 1. phi goes from 2 to 2 x 6 - 8 = 4, a change of 2. Amortized cost = 1 + (2) = 3.
Append 6: cost 1, phi 4, amortized 3.
Append 7: real cost 1. phi goes from 4 to 2 x 7 - 8 = 6, a change of 2. Amortized cost = 1 + (2) = 3.
Append 7: cost 1, phi 6, amortized 3.
Append 8: real cost 1. phi goes from 6 to 2 x 8 - 8 = 8, a change of 2. Amortized cost = 1 + (2) = 3.
Append 8: cost 1, phi 8, amortized 3.
Append 9: real cost 9, a resize that copies 8 elements. phi goes from 8 to 2 x 9 - 16 = 2, a change of -6. Amortized cost = 9 + (-6) = 3. The saved-up credit pays for the copy.
Append 9: cost 9, phi 2, amortized 3.
Append 10: real cost 1. phi goes from 2 to 2 x 10 - 16 = 4, a change of 2. Amortized cost = 1 + (2) = 3.
Append 10: cost 1, phi 4, amortized 3.
Append 11: real cost 1. phi goes from 4 to 2 x 11 - 16 = 6, a change of 2. Amortized cost = 1 + (2) = 3.
Append 11: cost 1, phi 6, amortized 3.
Append 12: real cost 1. phi goes from 6 to 2 x 12 - 16 = 8, a change of 2. Amortized cost = 1 + (2) = 3.
Append 12: cost 1, phi 8, amortized 3.
Real costs summed to 27. Amortized costs summed to 35, and phi ended at 8. The amortized column is 3 for every append after the first, however large the copy, because the potential was chosen so that cheap appends save exactly the credit a resize spends. And since the amortized sum minus the final potential equals the real sum, the amortized bound is a true bound on the real work: that telescoping is the whole method.
Amortized total 35 against real total 27.