I am getting time limit error for all the test case , please help me in the code
tle is becoz of your merge method which contains for loop inside a for loop
okay,…then how will i swap(inside merge function) without using two loop, please tell me.
see the merge sort algorithm
algo:
call the mergesort for the left half
then call the mergersort for the second half
then simply merge the 2 halves
merging of 2 sorted array hint:
make 2 pointers which are pointing to the first element of first half and other is pointing to the first element of 2nd half
i=0,j=0;
make temp arr[] of size equals to sum of both halves
then store the min value by comparing i and j value
and update the min pointer
okay okay , thank you …i got it