Question

A C++ implementation for merge sort is as follows.

int c[100]; //c[100] is a global array

mergesort(int a__, int low, int high){
__

int mid;

if (low < high) {

mid=(low+high)/2;

mergesort(a,low,mid);

mergesort(a,mid+1,high);

merge(a,low,high,mid);

}

return; }

void merge(int a__, int low, int high, int mid){ int i, j, k;
__

i = low;

k = low;

j = mid + 1;

while (i <= mid && j <= high){ if (ai < aj){ ck = ai;

k++;

i++;