News for hackers. Stuff that matters.
Re:Potential Quicksort replacement in java.util.Arrays with ... by jongraehl on Friday September 11, 2009 @03:06PM (#817894)
A small simplification/optimization:

        int third = len / div;
        third=third>0?third:1;

        // "medians"
        int m1 = left  + third;
        int m2 = right - third;
Instead of the worse:

        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;
        }

There are no comments on this comment yet.