I am not sure why you are asking people to make you understand the algorithm. I can just assist you you but you have to go through it.
In merge short you have to cut the array in two pieces. suppose you have 10 elements then high=0
and low=10-1=1
. mid = (9+0)/2 = 4
. So, you have divided the main array to 2 parts from 1th element to 5th and from 6th element to 10th (1..10). When ever you have more than one element in a piece you cut it into two again. At the end merge them i.e. add arrays again but in ascending order. Finally you get a single array sorted. Its very tough to explain every piece. I think this link from wiki can help. http://en.wikipedia.org/wiki/Merge_sort
Now comes the function calling. main function is calling merge_sort
it will pass low and hight (the full range of array) but within this function the merge_sort
will be called by himself twice with first half range (starting to mid way and after midway to last element). Each call will again do the same (divide the array and call with first half and send half). This process will go on. merge
function will add the array in sorted manner. Thats all you need. If you are not clear print or debug the value of parameters.