Why? Is it faster or more efficient?
For systems with one core, we can use quicksort. What should we use on systems with two cores, four cores, or eight cores?
Quicksort has the advantage of being completely in place, so it does not require any additional storage, while mergesort (which is actually used by Arrays.sort() for object arrays) and other (all?) guaranteed O(n*log n) algorithm require at least one full copy of the array. For programs that sort very large primitive arrays, that means potentially doubling the overall memory usage.
Arrays.sort()
2.1m questions
2.1m answers
60 comments
57.0k users