<DS/>DS_VISUALIZER
FoundationsOOPArraysLinked ListStacksQueuesTreesGraphsHashingStrings
exploreExplore
homechevron_rightTopicschevron_rightFoundationschevron_rightAmortized Analysis
savings

FOUNDATIONS · AMORTIZED

Amortized Analysis

Spread the cost: aggregate, accounting and potential methods.

Choose a lesson

calculatearrow_outward

Aggregate Method

Total over n ops ÷ n.

O(1) amortizedO(n)
savingsarrow_outward

Accounting Method

Overcharge cheap ops; the bank pays spikes.

O(1) amortizedO(n)
battery_charging_fullarrow_outward

Potential Method

Φ stores energy; spikes release it.

O(1) amortizedO(n)