public static int[] mergeSort(int[] a){
  if (a.length == 1)   return a;
  int[] x=mergeSort(Arrays.copyOfRange(a,0,a.length / 2));
  int[] y=mergeSort(Arrays.copyOfRange(a,a.length / 2,a.length));
  return merge(x,y);
}

public static int [ ] mergeSort ( int [ ] a ) { if ( a . length == 1 ) return a ; int [ ] x = mergeSort ( Arrays . copyOfRange ( a , 0 , a . length / 2 ) ) ; int [ ] y = mergeSort ( Arrays . copyOfRange ( a , a . length / 2 , a . length ) ) ; return merge ( x , y ) ; }
merge sort . < p / > time complexity : o ( n log n ) space complexity : o ( n ) ( also needs o ( log n ) stack space as it is recursive )
