Pregunta de entrevista de Elastic

What does amortised 1 mean?

Respuesta de la entrevista

Anónimo

21 jul 2017

Assuming you have for example an ArrayList, which expands automatically, in case the capacity is exceeded. Now the expand operations happens rarely, while adding new elements to the underlying array is a constant time operation. Thus the fact that the expand happens rarely and adds are in constant time, the adds compensate for the expensive expand operation.