Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion StandardDeviation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ double mean(const std::vector<double>& vec) {
}

double standard_deviation(const std::vector<double>& vec) {
//complete the function
double deviations = 0.0;
double m = mean(vec);
for (double it : vec) {
deviations += ( (it-m) * (it-m) );
}
return sqrt( deviations / vec.size() );
}

int main() {
Expand Down