标签:
void LinListSort(LinList<T> &L)
{
ListNode<T> *curr, *pre, *p, *q;
p = L.head->next; //原单链表
L.head->next = NULL; //新单链表
while(p != NULL)
{
curr = L.head->next;
pre = L.head;
while(curr != NULL && curr->data <= p->data)
{
pre = curr;
curr = curr->next;
}
q = p;
p = p->next;
q->next = pre->next;
pre->next = q;
}
}]
标签:
原文地址:http://www.cnblogs.com/it-xiaojun/p/4640581.html