Updated all sorting functions to accept a comparator function as an optional argument. If none is passed, the default std::less<>() is used.