[EMAIL PROTECTED] wrote:

<SNIP>
> OK. So the random order - quicksort marginally outperforms heapsort. For 
> the already sorted case, quicksort is rather better than heapsort, but 
> its margin goes down as the count goes up. However, with the data all 
> the same... ooopppsss.... my quicksort has fallen headlong into the 
> O(n*n) trap.

That has always been a 'failing' of the quicksort, when the data are in sorted 
order, it takes 'forever' to finish. I was taught that at college and was 
reminded of it when I wrote "PrinterMaster 2" - I used a quicksort internally 
and if it was run twice, the first one was quick (the data were random) and the 
second took ages (the data were sorted already).

In the end, I ripped the guts of the quicksort out and replaced it with some 
other sort, probably a bubble sort as I think the size of the array being 
sorted was limited to 200 entries or something. Then again, maybe I used 
something else instead.


Cheers,
Norman.

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to