in a for loop copy the values of the Yarray that are in the first half of the Xarray to the first half of the Zarray, and copy the values from the Yarray that are in the second half of the Xarray into the second half of the Zarray. Here is the code I used:
int f = start;
int g = middle + 1;
for (int i = l; i <= r; i++)
if (y[i].p > m)
z[g++] = y[i];
else
z[f++] = y[i];