typedef struct LinkNode { int data; struct LinkNode *next; } LinkNode, *LinkList; void quickSortLinkList(LinkList list,LinkNode *end) { LinkNode * p = list; LinkNode *refer = p->next; if(list->next ==end) return; while(p->next!=end) { if(p->next->data < refer->data) //小于就是升序 大于就是降序 { LinkNode *listnext = list->next; list->next = p->next; LinkNode* pnextnext = p->next->next; p->next->next = listnext; p->next = pnextnext; } else p=p->next; } quickSortLinkList(list,refer); quickSortLinkList(refer,NULL); } int main() { LinkList *list ; /* 此处给链表赋值 */ quickSortLinkList(list,NULL); }
标签:单链,end,C语言,list,next,quickSortLinkList,排序,LinkNode,refer From: https://www.cnblogs.com/woyuele/p/16848658.html