链表排序

void sort(NODE *head){
    NODE *p=NULL;
    while(p!=head){
        NODE *tmp=head;
        for(tmp=head;tmp->next!=p;tmp=tmp->next){
            if(tmp->score>tmp->next->score){
            int t=tmp->score;
            tmp->score=tmp->next->score;
            tmp->next->score=t;
            }   
        }   
        p=tmp;
    }   
}

参考:

https://blog.csdn.net/yizhangbiao/article/details/51018434
https://blog.csdn.net/bitboss/article/details/51602826

posted @ 2018-03-29 10:35  Hsinwang  阅读(93)  评论(0编辑  收藏  举报