Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort
Jonathan Graehl
graehl at isi.edu
Fri Sep 11 19:09:48 UTC 2009
Nice.
> int third = len / div;
>
> // "medians"
> int m1 = left + third;
> int m2 = right - third;
>
> if (m1 <= left) {
> m1 = left + 1;
> }
> if (m2 >= right) {
> m2 = right - 1;
> }
I'd suggest this instead:
int third = len / div;
third=third>0?third:1;
// "medians"
int m1 = left + third;
int m2 = right - third;
More information about the core-libs-dev
mailing list