<span style="font-family:Comic Sans MS;font-size:18px;">//selectSort.h<span id="transmark"></span>
#include<iostream>
#include<vector>
using namespace std;
template<typename T>
void selectSort(vector<T> &v){
for(auto i=v.begin();i!=v.end()-1;i++){
for(auto n=i+1;n!=v.end();n++){
if(*n<*i)
swap1(*n,*i);
}
}
}
template<typename T>
void swap1(T &a,T &b){
auto temp=a;
a=b;
b=temp;
}
template<typename T>
void show(vector<T> &v){
for(auto p:v)
cout<<p<<endl;
}</span>
直接选择排序1.0
最新推荐文章于 2022-07-13 20:01:40 发布