选择排序(select sort)
来源:互联网 发布:淘宝优惠券赚佣金算的 编辑:程序博客网 时间:2024/06/06 23:08
选择排序算法就是在待排序列中每次找到最大(最小)的关键字,并且放在已排好序的子序列的前面(后面),直到排序 结束。
时间复杂度为O(n^2)
稳定性:不稳定
C++实现代码:
template <typename T>void SelectSort(T arr[], int n){ for (int i = 0; i < n; i++) { int current_Minindex = i; for (int j = i + 1; j < n; j++) { if (arr[j] < arr[current_Minindex]) { current_Minindex = j; } } swap(arr[i], arr[current_Minindex]); }}
阅读全文
0 0
- 选择排序(Select Sort)
- 选择排序(select sort)
- 选择排序----select sort
- 选择排序(select sort)
- 选择排序Select Sort
- 选择排序-Select Sort
- 选择排序 select sort
- 算法----选择排序(select sort)
- 简单选择排序(Simple Select Sort)
- [排序] 选择排序(Select Sort)
- 无聊写排序之 ---- 选择排序(Select Sort)
- 选择排序(selection sort)
- 选择排序(selection sort)
- 选择排序(selection sort)
- 选择排序(Selection Sort)
- 选择排序(Selection Sort)
- 选择排序(selection sort)
- Selection Sort(选择排序)
- mycat实现mysql读写分离
- USCAO Section 1.2 Dual Palindromes
- JSTL常用标签
- MinGW安装和使用
- 为什么不可以从一个 static 方法内部发出对非 static 方法的调用
- 选择排序(select sort)
- JDBC入门基本点(举例mysql)
- greenrobot 开源 android
- MFC绘图
- 《Using OpenRefine》翻译~15
- FL2440wifi模块学习之用rt3070芯片使开发板变为路由器上网
- CSS简介
- Unity编辑器扩展
- Android&H5互调