Le 19/05/2010 11:02, Dmytro Sheyko a écrit :
Vladimir,

I can see that you changed sortNegZeroAndNaN(float[]...) but probably forgot to change sortNegZeroAndNaN(double[]...).

You really puzzled me with failed testcase and note that sorting algorithm (without special attention to zeros) generally may change number of negative zeros.
I will provide my comments later.

As for counting sort, I think we should use single format style over the file (unless we have valuable reason not to do this). I mean to choose
1)
if (toIndex - fromIndex > COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR) {
            countingSort(a, fromIndex, toIndex);
            return;
        }
        sort(a, fromIndex, toIndex - 1, true);
2)
if (toIndex - fromIndex > COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR) {
            countingSort(a, fromIndex, toIndex);
        } else {
            sort(a, fromIndex, toIndex - 1, true);
        }
I prefer the second one.

Thanks a lot,
Dmytro Sheyko

But the former have a more compact bytecode representation (return vs goto) and avoid an unecessary jump for interpreters.

Rémi

Reply via email to