cs325/hw1/mergesort.cpp
//Driving function for the merge sort algorithm, recursively calls itself
Driving function for the merge sort algorithm, recursively calls itself
Driving function for the merge sort algorithm recursively calls itself
void mergeSort(int *arr, int leftBound, int rightBound) {
	if (leftBound < rightBound) {
		int mid = (leftBound + rightBound - 1) / 2;
		mergeSort(arr, leftBound, mid);
		mergeSort(arr, mid + 1, rightBound);
		merge(arr, leftBound, mid, rightBound);
	}
}
void mergeSort ( int * arr , int leftBound , int rightBound ) { if ( leftBound < rightBound ) { int mid = ( leftBound + rightBound - 1 ) / 2 ; mergeSort ( arr , leftBound , mid ) ; mergeSort ( arr , mid + 1 , rightBound ) ; merge ( arr , leftBound , mid , rightBound ) ; } }
Driving function for the merge sort algorithm, recursively calls itself
Driving function for the merge sort algorithm recursively calls itself
//Find the middle of the array //Recursively call mergeSort to sort two halves of the array every recursion //Merge the two halves