sort.c
// merge sort with auxiliary array allocated
merge sort with auxiliary array allocated
merge sort with auxiliary array allocated
void mergeSortRecursive(int array[], int n, int auxiliary[]) {
	if (n > 1) {
		int mid = n / 2;
		mergeSortRecursive(array, mid, auxiliary);
		mergeSortRecursive(array + mid, n - mid, auxiliary);
		merge(array, array + mid, mid, n - mid, auxiliary);
	}
}
void mergeSortRecursive ( int array [ ] , int n , int auxiliary [ ] ) { if ( n > 1 ) { int mid = n / 2 ; mergeSortRecursive ( array , mid , auxiliary ) ; mergeSortRecursive ( array + mid , n - mid , auxiliary ) ; merge ( array , array + mid , mid , n - mid , auxiliary ) ; } }
merge sort with auxiliary array allocated
merge sort with auxiliary array allocated
// array with size 1 or less is sorted // recursively sort the first half // recursively sort the second half // merge the sorted two halves