amortized constant time
Constant cost on average over many calls, even though an occasional call is expensive.
ArrayList.add copies its array when full, growing it by half, so copies are rare enough that the average add is constant.
See also
Constant cost on average over many calls, even though an occasional call is expensive.
ArrayList.add copies its array when full, growing it by half, so copies are rare enough that the average add is constant.
See also