Home:ALL Converter>MIPS merge sort recursion

MIPS merge sort recursion

Ask Time:2012-08-22T18:35:03         Author:arbit14

Json Formatter

I need to write a MIPS assembly language code for merge sort. I have already created the merge function but the merge_sort function that uses recursion extensively confuses me. I have posted the reference C code for the same. I understand that stacks will have to be used, however, unable to do it myself being a beginner, I would appreciate any kind of help.

int merge_sort(int arr[],int low,int high)
{
  int mid;
  if(low<high) {
mid=(low+high)/2;
// Divide and Conquer
merge_sort(arr,low,mid);
merge_sort(arr,mid+1,high);
// Combine
merge(arr,low,mid,high);
 }

 return 0;
}

Author:arbit14,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/12071251/mips-merge-sort-recursion
yy