Dynamic Arrays
Many languages have dynamic arrays, arrays that automatically resize, typically doubling whenever the array becomes full. Like static arrays, access is still , but doubling takes .
Doubling is rare enough that insertion (amortized) is still . The logic goes like this: if you have an array of elements, the most recent time the array doubled, elements were copied, the second most recent time, elements were copied, the third most recent time, elements were copied, and so on. So for total insertions, the total number of elements that have been copied is , which is less than .
So on average, insertion is -- however, worst-case insertion is .