Re:FreeBSD replaces bubblesort with mergesort on SYSINTs, re...
by SomeoneFromCA on Monday August 21, 2023 @05:35AM
(#37207202)
In any case, you should retract you claim that Bubble Sort is slower on already sorted case. It is CS101, that bubble sort is one of the fastest in this case.
[ Parent
| on HN ]
Re:FreeBSD replaces bubblesort with mergesort on SYSINTs, re...
by kragen on Monday August 21, 2023 @05:36AM
(#37207209)
oh yeah, you're right, thanks, it does do useless extra work if there are equal values in the list
it should say
if (tmp >= a[j-1]) break;
however, this doesn't make it fail to terminate, which is a possible reading of your bug report