Introduction To Computation and Programming Using Python, Revised - Guttag, John v..131
Introduction To Computation and Programming Using Python, Revised - Guttag, John v..131
The best-case running time is the running time of the algorithm when
the inputs are as favorable as possible. I.e., the best-case running time
is the minimum running time over all the possible inputs of a given size.
For linearSearch, the best-case running time is independent of the size
of L.
People usually focus on the worst case. All engineers share a common article of
faith, Murphys Law: If something can go wrong, it will go wrong. The worst-case
provides an upper bound on the running time. This is critical in situations
where there is a time constraint on how long a computation can take. It is not
43 A more accurate model for todays computers might be a parallel random access
machine. However, that adds considerable complexity to the algorithmic analysis, and
often doesnt make an important qualitative difference in the answer.