Questions: Amortized Analysis

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A safety-critical real-time system must guarantee that every operation completes within 1 millisecond. An engineer proposes using a dynamic array (which has O(1) amortized append). Should they use it?

AYes — O(1) amortized means every operation takes constant time in the worst case
BNo — 'amortized O(1)' still allows individual append operations to take O(n) time during a resize
CYes — amortized analysis provides probabilistic guarantees that O(n) resizes rarely occur
DNo — dynamic arrays have O(n) amortized append because of resizing overhead
Question 2 Multiple Choice

Using the aggregate method, what is the amortized cost of appending n elements to a dynamic array that starts with capacity 1 and doubles on resize?

AO(log n) per append — because resizes happen at logarithmic intervals
BO(n) per append — because the final resize copies n elements
CO(1) per append — because total work is ≈ 3n across n appends
DO(√n) per append — because resizes happen √n times
Question 3 True / False

Amortized analysis and average-case analysis both describe how an algorithm performs 'on average,' so they are equivalent in what they guarantee.

TTrue
FFalse
Question 4 True / False

In the accounting method of amortized analysis, operations are assigned a 'charge' (amortized cost) that may exceed their actual cost, with excess credited for future expensive operations.

TTrue
FFalse
Question 5 Short Answer

Explain why amortized analysis is NOT the same as average-case analysis, and describe a situation where the distinction matters.

Think about your answer, then reveal below.