Amortised Analysis is analysing algorithm performance when the worst choice out of every possible option is taken.
Example:
Conduct an amortised analysis of this algorithm:
if (thing1) {
doStuff();
}
if (thing2) {
doStuff();
}
if (thing3) {
doStuff();
}
To conduct an amortised analysis of this sequence of if
statements, for each statement, we need to select the worst thing that can possibly happen (performance wise).
In this case, the amortised runtime of the algorithm would be whatever happens when thing1
, thing2
and thing3
are all true
as it causes the most operations to happen.