选择排序 与 插入排序
文章目录选择排序插入排序
选择排序
中心思想 : 通过一次遍历后,将最小的元素放到“前面”,以此类推(在遍历过程中记录位置的是下标索引)
//**************** 选择排序 *********************
#include <iostream>
using namespace std;
template <typename T>
void SelectSort(T arr[],int n){
for(int i = 0;i < n;i++)
原创
2020-08-24 16:23:37 ·
114 阅读 ·
0 评论