Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

merge sort in c

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);
}
}
Source by www.edureka.co #
 
PREVIOUS NEXT
Tagged: #merge #sort
ADD COMMENT
Topic
Name
2+2 =