How to demonstrate bigO cost of algorithms?

Erik Max Francis max at alcyone.com
Wed Jun 2 20:12:56 EDT 2004


Josh Gilbert wrote:

> If, on the other hand, you knew that one program took 3n+7 and another
> took
> (n^2) / 10^10 you WOULD say that one's O(n) and the other's O(n^2).
> This
> implies that the first one is faster for large data sets.

For very, very large data sets.  Remember that big-O notation is
designed to describe the behavior as n tends toward infinity (which is
why we drop the constant coefficients and the lesser terms).  It's
important to remember that big-O notation is not intended for a direct
performance comparison of two algorithms in the real world; it's
intended to examine scalability issues in the big picture.  Those
constant coefficients and lesser terms can make a big difference in the
real world, even for really quite large n.

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ I'll tell them that their daddy was / A good man
    -- India Arie



More information about the Python-list mailing list