Fix compilation error when using gcc/libstdc++.

That is, add missing #include <algorithm>.