ok, following what iMalc said, this is what i coded so far.....
(I hope i don't sound dumb )
Code:
void mergeN(Record *a, int lo, int hi, int (*comp_func)(const, const))
{
Record *b = malloc(sizeof(Record)*hi);
int i=0;
int k=0;
int j=i+1;
/*Copy one item from array to temp*/
*(a+i) = *(b+i);
while(i<=hi)
{
/*If next item less than what was last
* wrote to, write to temp*/
if(comp_func((a+j),(a+i)) < 0)
{
*(b+k++) = *(a+j++);
}
else
{
/*write back to array*/
*(a+i++) = *(a+j++);
}
}
}
Not quite sure about that, but it'll give two array with a bitonic order right?
But how do i split it down further?
And, where to merge them?