#include <iostream> using namespace std; /** Simple Select Sort * brief: * Key: * * position: the max index * * trip: Begin and End(:n-i) * * swap * */ template <typename T> void simpleSelect(T* a, int n) { T max; int pos; for (int i = 0; i < n; i++) { max = a[0]; pos = 0; for(int j =0; j < n-i; j ++) { if(max < a[j]) { max = a[j]; pos = j; } } swap(a[pos], a[n-i-1]); } }