Fix compile error with VS 2013

According to this http://msdn.microsoft.com/en-us/library/vstudio/bb531344(v=vs.120).aspx, <algorithm> must be included to use std::min() and std::max()