Message-ID: <6MIHn7irJaB@09.viking.ruhr.com>
X-Gateway: ZCONNECT UU viking.ruhr.com [DUUCP BETA vom 06.11.1996]
References: <57j5dh$sh3$1@goanna.cs.rmit.edu.au> <6M5-4oabJaB@09.viking.ruhr.com> <E1uDzs.2AI@research.att.com>
From: roc@viking.ruhr.com (Rolf Czedzak)
Subject: Re: Mergesort: why's it efficient?
Date: 05 Dec 1996 00:00:00 +0000
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!fas-news.harvard.edu!newspump.wustl.edu!news.ecn.bgu.edu!news.maxwell.syr.edu!mr.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!blackbush.xlink.net!ins.net!viking.ruhr.com!roc
Newsgroups: comp.lang.c++,comp.sys.mac.programmer.help,comp.lang.lisp
Distribution: world
Lines: 54
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:231520 comp.sys.mac.programmer.help:44579 comp.lang.lisp:24043

Andrew Koenig  wrote:          <E1uDzs.2AI@research.att.com>

AK> In article <6M5-4oabJaB@09.viking.ruhr.com> roc@viking.ruhr.com (Rolf
AK> Czedzak) writes: 
AK> 
AK> > Your argument pushes _any_ 'realistic problem' into class O(1).
AK> 
AK> Not at all.   

Whenever you agree in upper limits, you at once get constants dominating
_any_ function of n.

AK> Admittedly the argument is entirely subjective, but
AK> in practice, computers have the property that if you ask them to
AK> store N objects, N will be subjectively large but log N will not be.

Which is hardly a computer property. ;-)

AK> To make things more concrete, consider N=1,000,000, and look at four
AK> programs with different performance characteristics:
AK> 
AK> 	A program that runs in 1 microsecond takes 1 microsecond :-)
AK> 	A program that runs in N microseconds takes 1 second
AK> 	A program that runs in N log N microseconds takes about 20 seconds
AK> 	A program that runs in N^2 microseconds takes 11.6 days.

If You want me to read that like:
'A program that runs in O(?) takes ... microseconds ?'
I agree, not even insisting that the first program might take 20 days
and still belong to O(1).
Given a factor of 20 between 2 applications makes the second one 
unusable -look back some 10 years and get app. that difference in
(hardware) computing power. Now make me believe, that todays applications
can be run on (almost) yesterdays hardware. Or imagine the O(n) and
O(n log n) applications are not just write only ones, but run a few
thousend times a month. Its no longer the same class of programs.

AK> So what I am claiming is that, for practical purposes, a program that
AK> runs in 1 second is nearly equivalent to one that runs in 20 seconds,
AK> when you are comparing them with programs that run in 1 microsecond
AK> or in 11.6 days. 

An Apple ][ is almost as good as a Pentium based computer comparing
them with no computer at all.

AK> Again: O(N log N) is almost as good as O(N).  It is not almost as
AK> good as O(1), and is much better than O(N^2).

Its uncomparable. O(n) might easily be outscored by O(N^2) for all
practical problems.

AK> 				--Andrew Koenig

Rolf
