All books

Professional

Apps About Coach Log in Start reading

Computer Science · Glossary

What is Worst-case, best-case and average-case cost?

Also known as: worst-case cost · best-case cost · average-case cost

Definition 13.6 University Computer Science — Year 1 · Chapter 13 — Asymptotic Analysis and Recurrences

For an algorithm whose cost on an input xx is C(x)C(x), and InI_n the finite set of inputs of size nn considered, the worst-case cost is max⁡x∈InC(x)\max_{x \in I_n} C(x), the best-case cost is min⁡x∈InC(x)\min_{x \in I_n} C(x), and the average-case cost is 1∣In∣∑x∈InC(x)\frac{1}{|I_n|}\sum_{x \in I_n} C(x).

Read in context →