Advertisement
clairec

selection sort

Nov 10th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. template <typename T>
  2. void selection_sort(std::vector<T>& a) {
  3. const auto end = a.end();
  4. for (auto i = a.begin(); i < end; i++) {
  5. std::iter_swap(i, std::min_element(i, end));
  6. }
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement