标签:next new style sort pre size i++ 快排 冒泡
1、冒泡排序
void Sort(List &L) { List r,q; r= L->next; List p = new LNode; p->next = NULL; for (q=L->next;q;q=q->next)//for(int i=0;i<num;i++) { for (r=L->next;r->next; r=r->next) { if (r->books.price < r->next->books.price) { p->books = r->next->books; r->next->books = r->books; r->books = p->books; } } } }
或者
for (int i=0;i<num;i++) { r = L->next; for (int j=0;j<num-i-1;j++) { if (r->books.price < r->next->books.price) { p->books = r->next->books; r->next->books = r->books; r->books = p->books; } r = r->next; } }
2、快排
标签:next new style sort pre size i++ 快排 冒泡
原文地址:https://www.cnblogs.com/h694879357/p/11665120.html