Suppose that a precisely sized array is used to hold data, and that each time the array size is to be increased, it is increased by exactly one and the data are copied over.
Prove that, in the process of growing an array incrementally from size $0$ to size $n$, approximately $n^2$ values must be copied.
so here what I have tried. p.s I have no idea what I am doing here. I get that in order to loop though array of numbers than the timing is $n$.
[1] = 1 value
|
[1, 2] = 2 values
| |
[1, 2, 3] = 3 values
| | |
[1, 2, 3, 4] = 4 values
| | | |
[1, 2, 3, 4, 5, ..., $n$] = $n$ values