您的位置:首页 > 其它

直接选择排序1.0

2015-08-13 14:16 281 查看
<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: