1
2
3
4
5
6
7
8
9
10
11
12
13
14
void mergeSort(int arr[], int l, int r)
{
if (l < r)
{
// Finding mid element
int m = l+(r-l)/2;
// Recursively sorting both the halves
mergeSort(arr, l, m);
mergeSort(arr, m+1, r);
// Merge the array
merge(arr, l, m, r);
}
}