AI engineering glossary · Data structures algorithms

What is amortized analysis?

Amortized analysis: A way of measuring the average cost per operation over a worst-case sequence of operations, so an occasional expensive step is spread across many cheap ones. It differs from average-case analysis because it needs no probability assumptions.

Level: advancedTopic: Data structures algorithms

Amortized analysis: an example

Appending to a dynamic array is O(1) amortized: an occasional resize copies all n items, but that cost is shared over the n cheap appends before it.

Related terms

More Data structures algorithms terms

Where you learn it

Amortized analysis is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.