Given below is a function which is part of a bigger program implementing Merge Sort http://linux.wku.edu/~lamonml/algor/sort/merge.html

Now I cant figure out the way this recursion is working . According to me there would be infinite number of calls made between "a " and "b" .Code:void merge_sort(int a[], int low , int high) //a { int mid; if(low<high) { mid=(low+high)/2; merge_Sort(a,low,mid)//b; merge_Sort(a,mid+1,high);//c simple_merge(a,low,mid,high); //d } }

Let us take array 5,8,10 we pass at first merge_sort(a,0,2). mid becomes 1 so b calls a with low=0 and high = 1. Next mid becomes 0 and b calls a with low=0 and high =0 . This time low=high and the "if condition" is false , mid will be 0 and will continue to be 0 and hence "b" will go on calling "a" . But the program actually works perfectly , so where am I wrong in my tracing of the program?