Page 252 - DCAP605_ADVANCED_DATA_STRUCTURE_AND_ALGORITHMS
P. 252
Unit 12: Sorting
y[k] =x[i]; Notes
i++ ;
k++;
}
else
{
y[k] = x[j];
j++;;
k++;
}
}
while (i <= m)
{
y[k] =x[i];
i++;
k++;
}
while (j <= n)
{
y[k] = x[j];
j++;
k++;
}
}
void mpass(int x[],int y[],int 1, int n)
{
int i,j;
i = 1;
whi1e(i <= n - 2 * 1 + 1)
{
merge(x, y, i, i+l-1, i+ 2 * 1-1);
i = i + 2 * 1;
}
if((i+1-1) < n)
merge(x, y, i, i+1-1, n);
else
while (i <= n )
{
y[i] =x[i];
i++;
LOVELY PROFESSIONAL UNIVERSITY 247