use std::swap instead of our own swap functions
use std::array instead of C-style array

That way, we can use min/max_element and algorithms header