How so? Heapsort isn't stable either.  Is there a variant I'm not aware of?


On 29/11/2022 16:36, Marco van de Voort via fpc-devel wrote:

On 29-11-2022 17:34, J. Gareth Moreton via fpc-devel wrote:
This is why I hope my own improvement to the version in TArrayHelper could be used instead:

Now that I know where Introsort is in the sortalgs.pp unit, I'll see about improving Introsort there too.

Regarding a stable sort, what does GCC's "std::stable_sort" use? - it resembles merge sort.  (The algorithm before it in the video, "std::sort", is introsort, but it postpones doing the insertion sort until the very end, which doesn't work in practice because of caching issues)

Usually it is heapsort that is picked as alternative to quicksort if stable algo is needed.

fpc-devel maillist  -

fpc-devel maillist  -

Reply via email to