All challenges
Multiple ChoiceHard 30s

Amortized Cost

Pushing to a dynamic array is O(1) amortized because:
Options
  1. 1The operating system pre-allocates all needed memory upfront
  2. 2Available memory is effectively infinite on modern machines
  3. 3Doubling capacity spreads the rare O(n) resize cost over many pushes
  4. 4Each push copies exactly one single element into free space

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle