clairec icon

selection sort

clairec | PRO | 11/10/16 10:50:55 PM UTC | 0 ⭐ | 482 👁️ | Never ⏰ | []
text |

200 B

|

None

|

0 👍

/

0 👎

template <typename T>
void selection_sort(std::vector<T>& a) {
    const auto end = a.end();
    for (auto i = a.begin(); i < end; i++) {
        std::iter_swap(i, std::min_element(i, end));
    }
}

Comments