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

  1. Path: sparky!uunet!uunet.ca!geac!torag!zooid!ron
  2. From: ron@zooid.guild.org (Secret Mud)
  3. Newsgroups: rec.games.programmer
  4. Subject: Re: Advice needed for fastest sort algorthm
  5. Message-ID: <721929737.12971@zooid.guild.org>
  6. Date: 16 Nov 92 16:02:17 GMT
  7. Lines: 18
  8.  
  9. From: roberts@angelo.amd.com (Dave Roberts)
  10. >
  11. >My post was a knee jerk response that bubble sort is bad.  It's not.
  12. >Used wisely and carefully chosen, it's a beautiful thing.  I just hate
  13. >it when people automatically think that quicksort is the be-all
  14. >end-all sort of the millenium.
  15. >
  16. >You can now safely interview since you correctly recalled that bubble
  17. >is n*n. :-)
  18. >
  19.  
  20. A trivial mod to bubble sort can reduce the worst case to n*n/2.  The main
  21. thing is what is the sort being used for, and just how important speed is.  If
  22. it's a sort of an object list of max 20 objects, and it's mostly sorted
  23. already, then throw in a bubble sort and move on to the real programming
  24. problems.
  25.  
  26.  - Ron Sharp.
  27.