AlgoFrames

Why 2× and not +1

Standard · Multiple choice · about 3 min

Two dynamic arrays start at capacity 1 and receive the same 1,000 appends. Array A doubles its capacity when full. Array B adds one cell when full. Which statement is true?

Learn the idea first: Dynamic arrays: capacity, growth, amortized append, a visual lesson.

More Dynamic arrays: capacity, growth, amortized append problems