pset3/find/helpers_merge.c
void split_merge(int b[], int a[], int l, int r)
{
    
    // one element in the array means sorted
    if ( (r - l) < 2 )
    {
        return;
    }
    
    // find the middle
    int m = (l + r)/2;
    
    // split both sides recursively
    split_merge(a, b, l, m);
    split_merge(a, b, m, r);
    
    // merge back to A
    merge(b, a, l, m, r);
}
/**
 * Recursive split for the merge sort
 */
Recursive split for the merge sort
Recursive split for the merge sort
void split_merge(int b[], int a[], int l, int r)
{
    if ( (r - l) < 2 )
    {
        return;
    }
    int m = (l + r)/2;
    split_merge(a, b, l, m);
    split_merge(a, b, m, r);
    merge(b, a, l, m, r);
}
void split_merge ( int b [ ] , int a [ ] , int l , int r ) { if ( ( r - l ) < 2 ) { return ; } int m = ( l + r ) / 2 ; split_merge ( a , b , l , m ) ; split_merge ( a , b , m , r ) ; merge ( b , a , l , m , r ) ; }
Recursive split for the merge sort
Recursive split for the merge sort
// one element in the array means sorted // find the middle // split both sides recursively // merge back to A