In the Arrays class quick sort is used for sorting primitives but for sorting objects, it's merge sort.
I wonder why this is so?
The reason for using mergesort is that they want a stable algorithm - e.g. where equal objects (by
For primitives, equality implies "non-distinguish-ability". When sorting
Just a guess, but quicksort is O(n^2) in the worst case, while merge sort is stable (guaranteed O(n log n)).
The worst case for quicksort is triggered by equal values.. and equal primitives are identical, while "equal" objects may not be.