链表结构
typedef struct LNode{
int data;
struct LNode* next;
}LNode,*LinkList;
升序排列
LinkList sort_line(LinkList L1,LinkList L2){ //升序
LinkList p,newline;
newline = (LNode*)malloc(sizeof(LNode));
newline->next = NULL; //头结点下一个指空
p = newline;
L1 = L1->next; //指向内容
L2 = L2->next;
while(L1&&L2){ //两个内容比较
if(L1->data > L2->data){ //L1值大于L2则将L2值放入新链否则放L1
p->next = L2;
L2 = L2->next;
p = p->next;
}else{
p->next = L1;
L1 = L1->next;
p = p->next;
}
}
if(L1){
p->next = L1; //将剩余部分放入新链
}
if(L2){
p->next = L2;
}
return newline;
}