arrayscomplexity
Why dynamic array append is amortized O(1)
Anonymous
With geometric capacity growth, most appends are constant time, while an occasional resize copies existing elements. Across n appends, the total copying is O(n), so the amortized cost per append is O(1). One append can still take O(n) during a resize.
0