![](https://csdnimg.cn/release/download_crawler_static/86314682/bg6.jpg)
px=px->link;
}
while(py!=NULL)
{
pz=insert(pz,py->data);
py=py->link;
}
pz->link=NULL;
pz=zh;
zh=zh->link;
free(pz);
xh=NULL;
yh=NULL;
return(zh);
}
1. 16
typedef struct node {int data;
struct node *link;
} NODE;
NODE *insert(pc,x)
NODE *pc;
int x;
{
NODE *t;
t=(NODE *)malloc(sizeof(NODE));
t->data=x;
pc->link=t;
return(t);
}
void merge1(ha,hb,phc)
NODE *ha, *hb, **phc;
{
NODE *pa; *pb; *pc, *pa1, *pb1;
pa=(NODE *)malloc(sizeof(NODE));
pa->link=ha;
pa1=pa->link;
while(pa1->link!=ha)
pa1=pa1->link;
pa1->link=pa;
ha=pa;
pb=(NODE *)malloc(sizeof(NODE));
pb->link=hb;
pb1=pb->link;
while(pb1->link!=hb)
pb1=pb1->link;
pb1->link=pb;
hb=pb;
pa1=pa->link;
pb1=pb->link;
*phc=(NODE *)malloc(sizeof(NODE));
pc=*phc;
while(pa1!=ha&&pb1!=hb)
{
if(pa1->data<=pb1->hb)
{
pc=insert(pc,pa1->data);
pa1=pa1->link;
}
else
{
pc=inse
r
rt(pc,pb1->data);
pb1=pb1->link;
}
while(pa1!=ha)
{
pc=insert(pc,pa1->data);
pa1=pa1->link;
}
while(pb1!=hb)
{
pc=insert(pc,pb1->data);
pb1=pb1->link;
}
pc->link=(*phc)->link;
pc=*phc;
*phc=( *phc)->link;
free(pc);
}
1. 17
int print_l(head,n,i,k)
NODE *head;
int n,i,k;