Posted on 2006-06-20 21:02
Enjoy Life 阅读(5528)
评论(5) 编辑 收藏 引用 所属分类:
DS study
void MergList_L(LNode *La, LNode *Lb, LNode *Lc){
LNode *pa, *pb, *pc;
pa = La->next;
pb = Lb->next;
pc = Lc = La;
while(pa && pb){
if(pa->data <= pb->data){ //
小的先挂到Lc上去
pc->next = pa;
pc = pc->next;
pa = pa->next;
}
else{
pc->next = pb;
pc->next = pc;
pb = pb->next;
}
}
pc->next = pa? pa:pb; //
将剩余的所有节点直接挂到Lc上去
free(Lb);
}