for example :
link a:5->4->3->2->1->NULL
link b: NULL
Code:
typedef struct node* link;
struct node { int item; link next; };
....
link no_scan(int n, link a, link b)
{
int n1;
link xs1, xs2, c = NULL;
if(n == 0)
{
b = a;
return NULL;
}
if(n == 1)
{
b = a->next; //here will be th problem
a->next = NULL;
return a;
}
n1 = n/2;
xs1 = no_scan(n1,a,b);
xs2 = no_scan((n-n1),b,c); ///when i hit here, error, cos i pass(1,NULL,NULL);
b = c;
return merge(xs1,xs2);
}
i wanna make sure b has changed in the call no_scan(n1,a,b);
can anyone one help me, thanks a lot