https://blog.csdn.net/otuhacker/article/details/10366563
每次是小數的最后一個,然后用的next位置進行的交換,如果第二個數比第一個數小,就相當於第二數和自己進行交換
鏈表只能從前往后
pNode* partition(pNode* start,pNode* end){ int num = start->val; pNode* p = start; pNode* q = start->next; while(q != end){ if(q->val < num){ p = p->next; swap(p->val,q->val); } q = q->next; } swap(p->val,start->val); return p; } void quick_sort(pNode* start,pNode* end){ if(start != end){ pNode* index = partition(start,end); quick_sort(start,index); quick_sort(index->next,end); } }