Article View: comp.lang.misc
Article #4687O(n) sort and models of computation
From: gvcormack
Date: Sun, 01 Mar 1987 15:10
Date: Sun, 01 Mar 1987 15:10
25 lines
1849 bytes
1849 bytes
When you start arguing about memory addresses consuming log(n) space
and hence log(n) time to manipulate, you are starting to attack the
unit-cost RAM model of computation that is commonly assumed in
computing the time and space requirements of algorithms.
It is fine to attack this model, but let's not apply a double
standard. Comparison sorting requires n log n COMPARISONS. If
you assume a logarithmic cost model, I think it is fair to say
that comparing two keys of length log n requires log n time, and
therefore that comparison sorting requires OMEGA(n log n log n) time.
Radix sort does O(n) operations (not comparisons) on keys. If you
assume keys can be manipulated in unit time, you get O(n) sorting.
If you assume logarithmic cost, you get O(n log n), but are still
better off than comparison sorting by a factor of log n!
Of course, for any n that you are likely to run into in your lifetime,
you can find k such that k > log(n), and the practical significance
of this entire argument disappears. Be conservative, though -- a
while back a very large computer manufacturer thought k=24 was
adequate. Now, many believe k=32 does the trick...
--
Gordon V. Cormack CS Dept, University of Waterloo, Canada N2L 3G1
gvcormack@mum.waterloo { .CSNET or .CDN }
gvcormack@water { UUCP or BITNET }
Technical Details
Message-ID:
<834@watmum.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmum!gvcormackReferences:
<860@cullvax.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmum!gvcormack From: gvcormack@watmum.UUCP Newsgroups: comp.lang.misc Subject: O(n) sort and models of computation Message-ID: <834@watmum.UUCP> Date: Sun, 1-Mar-87 10:10:46 EST Article-I.D.: watmum.834 Posted: Sun Mar 1 10:10:46 1987 Date-Received: Sun, 1-Mar-87 17:53:34 EST References: <860@cullvax.UUCP> Organization: U of Waterloo, Ontario Lines: 25