2012-05-02, 03:36 PM
happylight Wrote:This is because of your choice of array to be sorted. You're using random numbers less than 1000 to fill your 6 million size array. This is going result in a lot of ties, which is quick sort's worst case situation.
If you change the RNG.nextInt(1000) to RNG.nextInt(size), you will see quick sort being faster than merge sort.
Was going to mention this. Quicksort is only faster than mergesort in certain scenarios.
Also an FYI quicksort has to sort completely random situations. If there's any semblance of order mergesort can be faster.

