Trivia ForgePlay free →

What is the amortized time complexity of the 'push' operation for a dynamic array that doubles in size when full?

Show answer

O(1)

While a single push might trigger a resize costing O(n), the total cost of n pushes is O(n) because resizing happens infrequently. Using the aggregate method, the average cost per operation is constant.

Also asked as:
  • For a dynamic array that doubles in size when full, what is the amortized time complexity of adding an element via 'push'?

Would you remember this in 6 months?

Trivia Forge uses spaced repetition so facts stick. Free, no signup needed.

Turn on Algorithms practice →

More Algorithms trivia

See all 83 →