MCPcopy Create free account
hub / github.com/Lakhankumawat/LearnCPP / mergesort

Function mergesort

D-DivideAndConquerAlgorithms/MergeSort.cpp:59–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59void mergesort(int arr[],int l,int r){
60
61// l and r defines from where to where we wants to sort.
62if(l>=r){
63 return;
64}
65 // finding mid
66 int mid=(l+r)/2;
67 // sending array to sort from l to mid
68 mergesort(arr,l,mid);
69 // sending array to sort from mid+1 to r
70 mergesort(arr,mid+1,r);
71 // after the sorted arrays came, merging the two sorted array ,hence division is done first and then succesfully conqure to sort array
72 merge(arr,l,mid,r);
73
74}
75
76int main(){
77

Callers 1

mainFunction · 0.85

Calls 1

mergeFunction · 0.70

Tested by

no test coverage detected