complexity of merge sort merge_sort(arrbegendstep if beg end set mid (beg end)/ call merge_sort (arrbegmidcall merge_sort (arrmid endmerge (arrbegmidend[end of ifstep end figure the running time of merge sort in the average case and the worst case can be given as ( log nalthough merge sort has an optimal time complexityit needs an additional space of (nfor the temporary array temp algorithm for merge sort programming example write program to implement merge sort #include #include #define size void merge(int []intintint)void merge_sort(int [],intint)void main(int arr[size]inprintf("\ enter the number of elements in the array ")scanf("% "& )printf("\ enter the elements of the array")for( = ; < ; ++scanf("% "&arr[ ])merge_sort(arr - )printf("\ the sorted array is\ ")for( = ; < ; ++printf(% \ "arr[ ])getch()void merge(int arr[]int begint midint endint =begj=mid+ index=begtemp[size]kwhile(( <=mid&( <=end)if(arr[iarr[ ]temp[indexarr[ ] ++else temp[indexarr[ ] ++index++if( >midwhile( <=end