每一趟从待排序的数据元素中选出最小(或最大)的一个元素,顺序放在已排好序的数列的最后,直到全部待排序的数据元素排完。
#include "stdafx.h"
#include <iostream>
#include <vector>
using namespace std;
void Show(vector<int> values)
{
for (auto value : values)
cout << value << " ";
cout << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
vector<int> values = { 9, 1, 9, 8, 2, 3, 5, 7, 6, 4 };
Show(values);
cout << endl;
for (int i = 0; i......
阅读全文