Best, Worst & Average Case
Consider an algorithm that searches for a value in a list.
How fast it finds the value depends on the position where the
value is located:
- if the value is first, it returns immediately. This is the
best case.
- if the value is last, it tries every other location before
finding it. This is the worst case.
The efficiency of an algorithm is really a band: it
lies between the best case and the worst case.
Asymptotic complexity: look only at the dominant term,
in the limit, of the efficiency function.