Пример #1
0
void merge(Item a[], int left, int mid, int right){
    int N = right-left+1, i;
    Item temp[N];
    mergeAB(temp,a+left,mid-left+1,a+mid+1,right-mid);
    for (i=0; i<N; i++){
            a[left+i] = temp[i];
    }
}
Пример #2
0
void mergesortABr(Item a[], Item b[], int l, int r)
{
    if (r-l <= 10) {
        insertion(a, l, r);
         return;
    }

    int m = (l+r)/2;
    mergesortABr(b, a, l, m);
    mergesortABr(b, a, m+1, r);
    mergeAB(a+l, b+l, m-l+1, b+m+1, r-m);
}