home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!uqcspe!cs.uq.oz.au!warwick
- From: warwick@cs.uq.oz.au (Warwick Allison)
- Newsgroups: rec.games.programmer
- Subject: Re: Advice needed for fastest sort algorthm
- Message-ID: <11123@uqcspe.cs.uq.oz.au>
- Date: 20 Nov 92 02:12:49 GMT
- References: <BxD5pt.DyI@news.cso.uiuc.edu> <1dj6jmINNder@tartarus.uwa.edu.au> <1992Nov12.195155.14124@kth.se> <1992Nov20.094100.165181@dstos3.dsto.gov.au>
- Sender: news@cs.uq.oz.au
- Reply-To: warwick@cs.uq.oz.au
- Lines: 43
-
- gjs@mustang.dsto.gov.au (Graeme Simpkin) writes:
-
- >I am really interested in the answer to the original post here, but
- >there appears to be a rolling discussion (and great I encourage it),
- >but can I ask some kind soul to post an article at the end with the
- >header:
-
- >Fastest sort algorithm -> HERE IT IS
-
- >when the results of the debate are apparent ?
-
-
-
- GROAN. If you'd read any of the "rolling discussion", you'd have got the
- clue that:
-
- THERE IS NO SUCH THING AS THE FASTEST SORTING ALGORITHM
-
- In some cases, Bubble Sort can beat Quick Sort. But not in others. Given
- random data, choose Quick over Bubble. Given almost sorted data, usually
- Bubble will be better. If you have data that has only a small number of
- keys (ie. lots of duplicates), use a Radix Sort. If you're sorting on
- temporary storage, try a File-based Merge Sort. If your programmers
- cost more than the next faster model of computer, use whatever is in
- your standard libraries.
-
- There are DOZENS (dare I say "HUNDREDS") of sorting algorithms. Which
- to use depends totally on the environment were the sort is to be used.
-
- Maybe you want to use the Monte Carlo Sort:
-
- 1. Swap two elements
- 2. See if all in order - if not, goto 2
-
- :-)
-
- --
- Warwick
- --
- _-_|\ warwick@cs.uq.oz.au /Disclaimer:
- / * <-- Computer Science Department, /
- \_.-._/ University of Queensland, / C references are NULL && void*
- v Brisbane, Australia. /
-