home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,026 of 2,978   
   Dr Engelbert Buxbaum to MSTR   
   Re: HOW TO SORT???   
   25 Jan 06 18:48:21   
   
   From: engelbert_buxbaum@hotmail.com   
      
   MSTR wrote:   
      
   > How can I do that???? I made a test, buy comparing ALL values MANY   
   > times and IT works, but VERY SLOW.. Is there any other way I can make   
   > it?   
      
   Yes, this so called bubble sort is usually the slowest possible   
   algorithm. Get a book on basic algorithms from your library. For a full   
   answer, D. Knuths Volume on "Searching and Sorting" from "The Art of   
   Computer Programming" is the ultimate source, albeit somewhat   
   intimidating for the beginner.   
      
   Have a look for "ShellSort" and "QuickSort", but note that although   
   these algorithms are faster than BubbleSort in most situations, they can   
   be slower if the data are pre-sorted. Thus there is no universal   
   algorithm quickest in all situation. Personally I like the ShellSort as   
   a compromise, it is not too slow with unsorted data (although slower   
   than QuickSort), but performance will not totally cave in if the data   
   are (even partially) pre-sorted, a big problem with QuickSort.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca