Advertisement
Aldin-SXR

private sort()

Mar 31st, 2020
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. /* Recursive merge sort logic */
  2. private static void sort(int[] elements, int[] aux, int low, int high) {
  3.     if (high <= low) {                              // 1
  4.         return;                                     // 1
  5.     }
  6.        
  7.     int mid = low + (high - low) / 2;               // 2
  8.     sort(elements, aux, low, mid);                  // 3
  9.     sort(elements, aux, mid + 1, high);             // 3
  10.     merge(elements, aux, low, mid, high);           // 4
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement