Advanced Data Structures & Algorithms
Q81 / 100

What is the amortized time complexity of push/pop for a dynamic array (e.g., ArrayList)?

Correct! Well done.

Incorrect.

The correct answer is C) O(1) amortized per operation

C

Correct Answer

O(1) amortized per operation

Explanation

Array doubling: each element is copied at most O(log n) times total. Over n pushes: total work is n + n/2 + n/4 + ... < 2n, so O(1) amortized per push.

Progress
81/100