码迷,mamicode.com
首页 > 编程语言 > 详细

// 选择排序 *源代码

时间:2016-03-28 13:30:55      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:



// 选择排序 源代码

void ChooseSort(int *a,int n){
      int i=-1,j,temp;
      for(;++i<n-1;){
            temp=i;
            for(j=i;++j<n;){
                   if(a[temp]>a[j]){
                             temp=j;
                    }
             } 
             if(i!=temp){
                   swap(&a[i],&a[temp]);
             }
        }
}

// 选择排序 *源代码

标签:

原文地址:http://www.cnblogs.com/mengfanrong/p/5328456.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!