home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 6060 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: pub.news.uk.psi.net!usenet
  2. From: Matthew Towler <Matthew.Towler@unicam.co.uk>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Sorting a list
  5. Date: 21 Mar 1996 12:38:44 GMT
  6. Organization: PSINet UK Public Usenet Site
  7. Message-ID: <4irikk$kn4@pub.news.uk.psi.net>
  8. NNTP-Posting-Host: 193.122.53.13
  9.  
  10. Avi Lev <avil@sapiens.com> writes:
  11. > Christopher Naas wrote:
  12. > > 
  13. > > What's the absolutely fastest algorithm for sorting a List with around 1000
  14. > > items alphabetically?
  15. > > 
  16. > well, the fastest way is no doubt, bubble sort!!! but you have to perform the sort on a 
  17. > list of pointers to the strings not on the strings themselves otherwise it'll be slower.
  18.  
  19. How can bubble sort be quicker than quicksort. All both methods need is a function to
  20. compare two entries, and as quicksort makes far less comparisions than bubble sort it must
  21. be quicker.  For 1000 entries it should be aproximately one hundred times faster (n^2 vs
  22. n log n time complexity).  If you are using C, and have ANSI libraries, why not use the
  23. sort() function, then all the work is done for you already apart from the comparison
  24. routine.
  25.