private static <T extends Comparable<T>> void kwayMergeSortRecursive(T[] a,int k, int lo, int hi) {
	  if (hi - lo < k) {		//If array to be sorted cannot be split into k parts anymore, use quicksort
		  qSort(a, lo, hi);  
		  return;
	  }
	 if (lo < hi) {
		 for (int i = 0; i < k; i++) {
			 kwayMergeSortRecursive(a, k, lo + (i+1)*(hi-lo+1)/k - 1, lo + i * (hi-lo+1)/k);
		 }
		 kwayMerge(a, lo, hi, k);
	 }
  }