next up previous
Next: Big Oh Notation Up: Introduction to algorithm design Previous: Random Access Machine model

Types of Complexity

Three types of complexity could be considered when analyzing algorithm performance. These are worst-case complexity, best-case complexity, and average-case complexity. Only worst-case complexity has found to be useful. Worst-Case running time for a function, f(n) such that tex2html_wrap_inline434 where a,b and c are constants can be described as a higher bounding limit for the shortest possible running time for any given "n" beyond some instance of "N"(big "n") such that tex2html_wrap_inline440. In this case, tex2html_wrap_inline442 is the higher bounding limit on f(n). tex2html_wrap_inline446. We will soon see how tex2html_wrap_inline448 for this example. More useful than best-case, since worst-case will tell how long an algorithm will run in the worst possible situation.

Average-Case running time for a function, f(n) such that tex2html_wrap_inline434 where a,b and c are constants can be described as an average between best-case and worst-case. Average-case isn't useful because in most cases it's hard to define the average.

Best-Case running time for a function, f(n) such that tex2html_wrap_inline434 where a,b and c are constants can be described as a lower bounding limit for the shortest possible running time for any given "n" beyond some instance of "N"(big "n") such that tex2html_wrap_inline440. In this case, tex2html_wrap_inline468 is the lower bounding limit on f(n). tex2html_wrap_inline472. We will soon see how tex2html_wrap_inline448 for this example. Best-case performance isn't really useful because it doesn't reflect normal operation of the algorithm.

 figure129
Figure 1: Relationship of Complexity Types



Nitin Sharma
Wed Oct 8 17:46:14 PDT 1997