选择排序
来源:互联网 发布:mac翻墙用什么软件好 编辑:程序博客网 时间:2024/05/17 04:51
class Program { static void Main(string[] args) { int[] test = new int[5]; for (int i = 0; i < 5; i++) { test[i] = Convert.ToInt32(Console.ReadLine()); } selectsort(test, 5); foreach (int a in test) { Console.Write(a + " "); } Console.WriteLine(); } static public void selectsort(int[] array, int length) { int i=0,j,min,temp_array,temp; while (i < length - 1) { min = array[i]; temp = i; for (j = i + 1; j < length; j++) { if (array[j] < min) { min=array[j]; temp = j; } } temp_array=array[i]; array[i] = array[temp]; array[temp] = temp_array; i++; } } }
0 0
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序:
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- 选择排序
- J2EE各层调用流程
- 匿名类型的创建和使用
- Winform中TreeView不同级节点设不同右键菜单
- 打完包后出现一个闪退问题
- 第一章总结
- 选择排序
- Xcode6编译SDWebImage报错解决方法(SDWebImageDownloaderOperation.m错误)
- Python 爬虫批量下载美剧 from 人人影视 HR-HDTV
- 问题及代码
- 基于Message的进程间通信实例
- IQueryFilter.whereclause的SQL语句设置规则
- 常用排序算法之性能比较
- 如何通过sql准确查出一天的数据
- 命令行关闭开启和删除驱动服务