直接选择排序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>
相关文章推荐
- 设计模式:20 想走?可以!先买票_迭代器模式
- 安装QEMU,虚拟mini2440开发板
- 移除input type="number"的上下箭头
- 快来寻找属于你的超级OA
- Linux深入篇之三:配置Nginx+LAMP动静分离
- 以太传输介质-RJ45网线接法(直通线、交叉线以及全反线)
- thinkphp的RBAC
- TestNG 图解说明
- 浅谈可重入函数与不可重入函数
- java 垃圾回收
- mysql left join right join区别以及优化收集
- CPU性能判断指标---上下文切换,运行队列和使用率
- Maximum Gap
- [iOS]UITableViewController 无法实现键盘自动适配
- java实现的数据库管理类(mysql)
- 【转载】简介参考《JetBrains C++ IDE 推荐》
- springMVC
- Arduino ESP8266 做Station模式连接路由器&服务器。基础模型
- UML类图中的六种关系
- 试图加载格式不正确的程序(Exception from HRESULT: 0x8007000B)