Logo 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_inline59043 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_inline60637 and tex2html_wrap_inline60639 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_inline60661 tex2html_wrap_inline60663
tex2html_wrap_inline60665 tex2html_wrap_inline60667 tex2html_wrap_inline60667 tex2html_wrap_inline60667 tex2html_wrap_inline60667
tex2html_wrap_inline60675 tex2html_wrap_inline60667 tex2html_wrap_inline60679 tex2html_wrap_inline60681 tex2html_wrap_inline60683
tex2html_wrap_inline60685 tex2html_wrap_inline60667 tex2html_wrap_inline60689 tex2html_wrap_inline60691 tex2html_wrap_inline60693
tex2html_wrap_inline60695 tex2html_wrap_inline60667 tex2html_wrap_inline60699 tex2html_wrap_inline60691 tex2html_wrap_inline60703
tex2html_wrap_inline60705 tex2html_wrap_inline60667 tex2html_wrap_inline60709 tex2html_wrap_inline60711 tex2html_wrap_inline60713
tex2html_wrap_inline60715 tex2html_wrap_inline60667 tex2html_wrap_inline60719 tex2html_wrap_inline60721 tex2html_wrap_inline60723
tex2html_wrap_inline60725 tex2html_wrap_inline60667 tex2html_wrap_inline60729 tex2html_wrap_inline60731 tex2html_wrap_inline60733
Table: Actual lower bounds assuming a 100 Mhz clock, tex2html_wrap_inline60653 and tex2html_wrap_inline59955


next up previous contents index

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