Added missing #include <algorithm> for std::min() and std::max()

Some compilers might fail.