41 throw Exception() <<
"Input vector has no element!";
49 std::sort(ordered.begin(), ordered.end());
51 result = (ordered[size / 2 - 1] + ordered[size / 2]) / 2.;
53 result = ordered[size / 2];
61 result =
static_cast<double>(sum) /
static_cast<double>(size);
defines the base Elements exception class
double average(const std::vector< int > &v)
Returns a particular version of the "average" of the vector values.
Elements base exception class.