|
|
@ -3,7 +3,7 @@
|
|
|
|
#include "histogram.h"
|
|
|
|
#include "histogram.h"
|
|
|
|
using namespace std;
|
|
|
|
using namespace std;
|
|
|
|
void
|
|
|
|
void
|
|
|
|
find_minmax(vector<double> numbers, double& min, double& max) {
|
|
|
|
find_minmax(const vector<double>& numbers, double& min, double& max) {
|
|
|
|
min = numbers[0];
|
|
|
|
min = numbers[0];
|
|
|
|
max = numbers[0];
|
|
|
|
max = numbers[0];
|
|
|
|
for (double x : numbers) {
|
|
|
|
for (double x : numbers) {
|
|
|
@ -20,7 +20,7 @@ vector<size_t> make_histogram(vector<double> numbers, size_t bin_count) {
|
|
|
|
vector <size_t> bins(bin_count);
|
|
|
|
vector <size_t> bins(bin_count);
|
|
|
|
double min, max;
|
|
|
|
double min, max;
|
|
|
|
find_minmax(numbers, min, max);
|
|
|
|
find_minmax(numbers, min, max);
|
|
|
|
size_t countt;
|
|
|
|
size_t count;
|
|
|
|
double bin_size = (max - min) / bin_count;
|
|
|
|
double bin_size = (max - min) / bin_count;
|
|
|
|
for (size_t i = 0; i < numbers.size(); i++) {
|
|
|
|
for (size_t i = 0; i < numbers.size(); i++) {
|
|
|
|
bool found = false;
|
|
|
|
bool found = false;
|
|
|
|