Trộn 2 ds lk tăng
struct node *tron_ds(struct node *f1, struct node *f2){
struct node *p, *q, *f;
f = NULL;
p=f1; q=f2;
while(p!=NULL && q !=NULL){
if(p->info.masv <= q->info.masv){
f = them_cuoi(f, p->info);
p = p->next;
}
else{
f = them_cuoi(f, q->info);
q= q->next;
}
}
if(p==NULL){
while(q != NULL){
f = them_cuoi(f,q->info);
q = q->next;
}
}
else if(q==NULL){
while(p != NULL){
f = them_cuoi(f,p->info);
p = p->next;
}
}
return f;
}
Bạn đang đọc truyện trên: Truyen247.Pro