1

I read sort algorithms that Java used in Arrays, so I opened jar files and read what java used when we call Array.sort();, so I found Java to check if the array's length is less then 286 and use quick sort otherwise use merge sort?

   static void sort(int[] a, int left, int right,
                     int[] work, int workBase, int workLen) {
        // Use Quicksort on small arrays
        if (right - left < QUICKSORT_THRESHOLD) {
            sort(a, left, right, true);
            return;
        }
.....
Laser Infinite
  • 253
  • 1
  • 15
yali
  • 1,038
  • 4
  • 15
  • 31
  • What Java version are you on? – Nexevis Jan 10 '20 at 21:12
  • @Nexevis Java 8 or higher same method – yali Jan 10 '20 at 21:29
  • See https://stackoverflow.com/questions/7770230/comparison-between-timsort-and-quicksort and https://stackoverflow.com/questions/4018332/is-java-7-using-tim-sort-for-the-method-arrays-sort/41129231#41129231. – VGR Jan 10 '20 at 21:40

0 Answers0