First you have to understand what a histogram is?
Second you have to figure out the minimum and maximum values in your dataset.
Third you subtract to get the range: Range = Maximum - Minimum.
Fourth you divide the range by the number of bins in the histogram which gives you the width of each bin. binWidth = Range / nBins
Fifth you find the minimum and maximum value of each bin.
Sixth you figure out (one data value at a a time)
which bin that element of the data set fits and then
Seven you add a value of one(1) to the bin total of that bin
For (i = 0; i < nBins; i++)
{
binMin
= Minimum + i * binWidth (Don't really need this as except for float point problems binMax = binMin[i - 1]
binMax = Minimum + (i + 1) * binWidth
}
Sixth order your Data (Most efficient way)
Seven count the number of data elements in the bin;
j = 0;
For (i = 0; i < nBins; i++)
{
binHeight = 0;
while (OrderedData[j] < bin)
{
binHeight++
j++;
}
} // No I didn't put it in a code box; it is psuedo-code.
Eight now you have height of each bin - now what are you going to do with it. Other than put a count above the bar - that information is trivial unless perhaps you have PhD in statistics working on multivariate weights or such nonsense I think not very much. I wonder how long it would take for a dataset of million values; a billion values; a trillion values; a value for dollar in our national debt; a value for a penny for each penny in our national debt.
I suggest if you actually got past the first step; you've asked the wrong question.
I've given you all the pseudo-code to build a histogram graph out of a basic bar chart. Lockheed Martin gets $120 an hour for me to do that; it took about 10 minutes so $20 in bit coins please
or since this ATOT just have a nice day; i showed you everything you asked - I'm hope you can solve your homework problem from it. Now shoo.