Cover 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_inline57984 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_inline59588 and tex2html_wrap_inline59590 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_inline59612 tex2html_wrap_inline59614
tex2html_wrap_inline59616 tex2html_wrap_inline59618 tex2html_wrap_inline59618 tex2html_wrap_inline59618 tex2html_wrap_inline59618
tex2html_wrap_inline59626 tex2html_wrap_inline59618 tex2html_wrap_inline59630 tex2html_wrap_inline59632 tex2html_wrap_inline59634
tex2html_wrap_inline59636 tex2html_wrap_inline59618 tex2html_wrap_inline59640 tex2html_wrap_inline59642 tex2html_wrap_inline59644
tex2html_wrap_inline59646 tex2html_wrap_inline59618 tex2html_wrap_inline59650 tex2html_wrap_inline59652 tex2html_wrap_inline59654
tex2html_wrap_inline59656 tex2html_wrap_inline59618 tex2html_wrap_inline59660 tex2html_wrap_inline59662 tex2html_wrap_inline59664
tex2html_wrap_inline59666 tex2html_wrap_inline59618 tex2html_wrap_inline59670 tex2html_wrap_inline59672 tex2html_wrap_inline59674
tex2html_wrap_inline59676 tex2html_wrap_inline59618 tex2html_wrap_inline59680 tex2html_wrap_inline59682 tex2html_wrap_inline59684
Table: Actual lower bounds assuming a 100 Mhz clock, tex2html_wrap_inline59604 and tex2html_wrap_inline58904.


next up previous contents index

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