Article View: rec.games.programmer
Article #1163Re: Advice needed for fastest sort algorthm
From: Michael O'Reilly
Date: Thu, 12 Nov 1992 04:21
Date: Thu, 12 Nov 1992 04:21
40 lines
2339 bytes
2339 bytes
Warwick Allison (warwick@cs.uq.oz.au) wrote: : >A radix sort has a time complexity of O(N), which means that it : >operates in linear time on N units of data. : Gee, I'm sure the theoreticians would LOVE to see the algorithm, : since it has been PROVED long ago that sorting takes O(N log N) : time OPTIMALLY. Maybe you should go back and check this. If the theorem exists at all, it will only apply for a (very small) sub-class of possible algorithms. The radix sort DOES run in N. While the radix sort is a fairly restricted sort, you can (fairly easily) construct an alogrithm that will beat N log N in the limit. (look up Knuth on the subject. He has more than a few words to say about it). On a parallel machine, I can sort N numbers in log N time. : >This integer may then be : >represented as the path in a binary tree, with the higher order : >bits represented as paths near the root and the lower order bits as : >paths near the leaves. : Guess what? The number of bits will be of the order LOG N !!!!!! No it won't. The running time of the algorithm is N * M, where N is the number of items of data, and M is the radix width. 1/2 a seconds thought will reveal to you that M is a constant, and thus the running time is.... O(n). : Let's rename this group to rec.games.!programmer, and succumb to the : community's belief that "games programmers" aren't real programmers : at all. All the Windows programmers and DOS device driver programmers : can then cross there arms smugly and shake their heads at us non- : programmers, who can only write GAMES, saying "gee, they've discovered : SORTING"... Looks like you haven't quite got the hang of it all yet... ;) Just FYI, sorting is still considered a rather hotly researched subject. : Warwick
Technical Details
Message-ID:
<1dsm3kINN5om@tartarus.uwa.edu.au>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!sgiblab!munnari.oz.au!uniwa!uniwa!nfmReferences:
<10991@uqcspe.cs.uq.oz.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!sgiblab!munnari.oz.au!uniwa!uniwa!nfm From: oreillym@tartarus.uwa.edu.au (Michael O'Reilly) Newsgroups: rec.games.programmer Subject: Re: Advice needed for fastest sort algorthm Date: 12 Nov 1992 12:21:08 +0800 Organization: Home Lines: 40 Message-ID: <1dsm3kINN5om@tartarus.uwa.edu.au> References: <10991@uqcspe.cs.uq.oz.au> NNTP-Posting-Host: tartarus.uwa.edu.au X-Newsreader: TIN [version 1.1 PL6]