选择排序法
2015-09-28 22:24
225 查看
#import <Foundation/Foundation.h> //选择排序 void selectsort(int arry[], int length){ for (int i = 0; i < length - 1; i++) { for (int j = i + 1; j < length; j++) { if (arry[i] > arry[j]) { int t = arry[i]; arry[i] = arry[j]; arry[j] = t; } } } } int main(int argc, const char * argv[]) { int a[5] = {1111, 222, 453, 888, 23}; selectsort (a, 5); //遍历数组 for (int i = 0; i < 5; i++) { printf("%d ", a[i]); } printf("\n"); return 0; }
相关文章推荐
- 【static&extern】static和extern的区别
- My Machine Learning
- numpy教程:矩阵matrix及其运算
- Python中bisect模块用法,及实现方式
- numpy教程 - 矩阵及其运算
- bzoj-3545 Peaks
- cf581A Vasya the Hipster
- OCP-V13-050
- 第二节 HTML基本架构学习
- ocp-v13-049
- 排序算法汇总
- jsoup
- 如何自定义添加数据列表(数据单元格)
- 深入 HBase 架构解析(1)
- NYOJ139 我排第几个
- Light oj 1217 - Neighbor House (II)(dp)
- Longest Valid Parentheses(最长有效括号)
- java基本数据类型练习
- android6.0新建项目中appcompat_v7导入问题以及导入的项目xml问题
- ubuntu VirtualBox中实现与主机文件的共享