Data Structures and Algorithms with Object-Oriented Design Patterns in C#
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_inline58265 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_inline59871 and tex2html_wrap_inline59873 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 1 GHz 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_inline59895 tex2html_wrap_inline59897
tex2html_wrap_inline59899 tex2html_wrap_inline59901 tex2html_wrap_inline59901 tex2html_wrap_inline59901 tex2html_wrap_inline59901
tex2html_wrap_inline59909 tex2html_wrap_inline59901 tex2html_wrap_inline59913 tex2html_wrap_inline59915 tex2html_wrap_inline59917
tex2html_wrap_inline59919 tex2html_wrap_inline59901 tex2html_wrap_inline59923 tex2html_wrap_inline59925 tex2html_wrap_inline59927
tex2html_wrap_inline59929 tex2html_wrap_inline59901 tex2html_wrap_inline59933 tex2html_wrap_inline59935 tex2html_wrap_inline59937
tex2html_wrap_inline59939 tex2html_wrap_inline59901 tex2html_wrap_inline59943 tex2html_wrap_inline59945 tex2html_wrap_inline59947
tex2html_wrap_inline59949 tex2html_wrap_inline59901 tex2html_wrap_inline59953 tex2html_wrap_inline59955 tex2html_wrap_inline59957
tex2html_wrap_inline59959 tex2html_wrap_inline59901 tex2html_wrap_inline59963 tex2html_wrap_inline59965 tex2html_wrap_inline59967
Table: Actual lower bounds assuming a 1 GHz clock, tex2html_wrap_inline59887 and tex2html_wrap_inline59185.


next up previous contents index

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