Logo Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Reality Check

``Asymptotic analysis is nice in theory,'' you say, ``but of what practical value is it when I don't know what c and tex2html_wrap_inline58064 are?'' Fallacies gif and gif showed us that if we have two programs, A and B, that solve a given problem, whose running times are tex2html_wrap_inline59668 and tex2html_wrap_inline59670 say, we cannot conclude in general that we should use algorithm A rather than algorithm B to solve a particular instance of the problem. Even if the bounds are both known to be tight, we still don't have enough information. What we do know for sure is that eventually, for large enough n, program A is the better choice.

In practice we need not be so conservative. It is almost always the right choice to select program A. To see why this is the case, consider the times shown in Table gif. This table shows the running times computed for a very conservative scenario. We assume that the constant of proportionality, c, is one cycle of a 100 MHz clock. This table shows the running times we can expect even if only one instruction is done for each element of the input.

 

 

n=1 n=8 tex2html_wrap_inline59692 tex2html_wrap_inline59694
tex2html_wrap_inline59696 tex2html_wrap_inline59698 tex2html_wrap_inline59698 tex2html_wrap_inline59698 tex2html_wrap_inline59698
tex2html_wrap_inline59706 tex2html_wrap_inline59698 tex2html_wrap_inline59710 tex2html_wrap_inline59712 tex2html_wrap_inline59714
tex2html_wrap_inline59716 tex2html_wrap_inline59698 tex2html_wrap_inline59720 tex2html_wrap_inline59722 tex2html_wrap_inline59724
tex2html_wrap_inline59726 tex2html_wrap_inline59698 tex2html_wrap_inline59730 tex2html_wrap_inline59732 tex2html_wrap_inline59734
tex2html_wrap_inline59736 tex2html_wrap_inline59698 tex2html_wrap_inline59740 tex2html_wrap_inline59742 tex2html_wrap_inline59744
tex2html_wrap_inline59746 tex2html_wrap_inline59698 tex2html_wrap_inline59750 tex2html_wrap_inline59752 tex2html_wrap_inline59754
tex2html_wrap_inline59756 tex2html_wrap_inline59698 tex2html_wrap_inline59760 tex2html_wrap_inline59762 tex2html_wrap_inline59764
Table: Actual lower bounds assuming a 100 Mhz clock, tex2html_wrap_inline59684 and tex2html_wrap_inline58984.


next up previous contents index

Bruno Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.