Skip to content
Preptima

Complexity Analysis interview questions

Deriving and defending time and space bounds, including amortised reasoning.

3 questions in Data Structures & Algorithms.

medium3

mediumConcept

Appending to a dynamic array is O(1) amortised. Derive that, then defend it against someone who points out that a single append copies the whole array.

Dynamic array append is amortized O(1) because capacity doubling makes the resize copy costs form a geometric series below 2n over n appends, even though one individual append can still be O(n). Use this complexity analysis answer to show the decision, trade-off, and evidence rather than a memorised definition. It also connects amortised analysis to the point an interviewer is testing.

5 minmid, senior, staff