List Merge( List L1, List L2 )
{
List L = (List)malloc(sizeof(struct Node));
List pL1 = L1->Next;
List pL2 = L2->Next;
List H = L;
while( pL1 && pL2 )//两链表都不空时
{
if(pL1->Data<=pL2->Data)
{
H->Next = pL1;
H = pL1;
pL1=pL1->Next;
}
else
{
H->Next = pL2;
H = pL2;
pL2=pL2->Next;
}
}
H->Next = pL1 ? pL1 : pL2; // 这里是把其中一个多出来的,短链进行拼接
L1->Next = NULL;
L2->Next = NULL;
return L;
}