Average-case analysis 2026-11-05
Average-case analysis measures an algorithm's expected cost when its inputs follow a specified probability distribution. If is the number of counted operations on input and is the probability of a size- input, then
The expected value is meaningful only after specifying both the input model and the counted operation. It is not an average over arbitrary anecdotes or necessarily the cost of a typical individual run.
For a successful linear search through distinct entries, suppose the sought entry is equally likely to occupy any position. Searching from the beginning uses comparisons if the entry is at position , so
For , this is five comparisons, whereas worst-case analysis gives nine. If the entry is absent with probability and otherwise has the same equal-position model, the expected count becomes . Changing the workload therefore changes the answer without changing the algorithm. Amortized analysis instead bounds the cost of a sequence of operations and need not assume an input probability distribution.
Michael L. Fredman 2026-11-05
Michael L. Fredman co-developed Fibonacci heaps with Robert Tarjan. Their 1987 paper uses deferred restructuring and amortized analysis to obtain constant amortized time for operations including insertion and decrease-key, with logarithmic amortized time for delete-min.[ref]
This matters in graph algorithms that repeatedly lower tentative priorities: reducing the cost of many decrease-key operations can improve a whole algorithm's bound. A single operation can still be expensive. The guarantee concerns the total cost of a sequence, so confusing amortized time with the worst-case analysis of each individual operation loses the point of the construction.
Worst-case analysis 2026-11-05
Worst-case analysis measures the largest resource use of a specified algorithm among inputs of the same size. If counts operations on input , the worst-case function is
The cost model and meaning of input size are part of the definition. A big O notation bound describes growth of this function, rather than a claim about how often the difficult input occurs.[ref]
For linear search of entries, looking for an absent item requires equality tests; finding the first item needs just one. Thus the worst-case comparison count is , even if many actual queries finish earlier. This supplies a guarantee for every allowed input, while an average-case analysis requires a stated distribution over inputs.