home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / rec / games / programm / 4763 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  1.9 KB

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