分类: C/C++
2011-06-07 16:50:38
void LinkList_Select_Sort(LinkList *L)//单链表上的简单选择排序算法
{
ElemType temp;
LinkList p, q, minp;
for(p = (*L)->next; p; p=p->next){
minp = p;
for(q = p->next; q; q = q->next){
if(q->data < minp->data)
minp = q;
}
if(minp != p){
temp = p->data;
p->data = minp->data;
minp->data = temp;
}
}
}