I need to merge into a single array multiple sorted arrays. I can manage merging two arrays but don't know how to do it for n arrays. Any help would be appreciated. Section of current code shown below:
Code:
while ((indexa<num_site1)&&(indexb<num_site2))
{
if (site1[indexa]<= site2[indexb])
{
res_arr[indexc++]=site1[indexa++];
}
else
{
(res_arr[indexc++]=site2[indexb++]);
}
}
while (indexa<num_site1)
{
res_arr[indexc++]=site1[indexa++];
}
while (indexb<num_site2)
{
res_arr[indexb++]=site2[indexb++];
}
*num_res_arr = indexc;