Fixed compile errors

Added #include <algorithm> for std::sort
Added #include <cstdlib> for std::strtol and std::strtod
Added #include <cmath> for HUGE_VAL and std::fabs
Replaced abs with fabs because its argument is double