Home » Developing U++ » U++ Developers corner » Funny way how NOT to speedup sorting of small arrays
Re: Funny way how NOT to speedup sorting of small arrays [message #22880 is a reply to message #19917] |
Mon, 24 August 2009 17:29   |
|
luzr wrote on Mon, 02 February 2009 00:06 |
mr_ped wrote on Sun, 01 February 2009 14:13 | I think with 10+ elements already quicksort can pay off.
|
In U++, we maintain 16 as threshold.
Quote: |
A well implemented quicksort will not hurt even with 2-3 elements that much.
|
There is only so much you can do with plain quicksort. All real quicksort algorithms switch to selection sort or insert sort when subsequence goes under certain threshold. It makes it quite faster.
Thus, if I could invent some faster variant for up to 16 elements, we would have a huge win...
Mirek
|
Founded on Wikipedia that one of the fasted sorting algorithm of small number of elements is Shell sort.
Here is another interesting article of sorting.
Ion Lupascu (tojocky)
[Updated on: Mon, 24 August 2009 17:30] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Apr 27 22:35:34 CEST 2025
Total time taken to generate the page: 0.03459 seconds
|