If I understand correctly, the only thing you need here is to find the maximum on the graph, where the maximum is not necessarily the highest peak, but the area with the highest density.
Here's a very simple, not too scientific, but quick O (n) approach. Run the histogram through the low pass filter. For instance. moving average. The length of your average can be indicated 20. In this case, the 10th value of your new modified histogram will be:
mh10 = (h1 + h2 + ... + h20) / 20
where h1, h2 ... are the values from your histogram. The following value:
mh11 = (h2 + h3 + ... + h21) / 20
which can be easily calculated using the previously calculated mh10, discarding it with the first component and adding a new one at the end:
mh11 = mh10 - h1/20 + h21/20
Your only problem is how you process the numbers at the edge of your histogram. You can reduce your moving average length to an existing length or add values before and after what you already have. But in any case, you could not cope with the peaks right on the edge.
And finally, when you have this modified histogram, just get the maximum. This works because now each value of your histogram contains not only itself, but also its neighbors.
A more sophisticated approach is to weigh the average value, for example, of a Gaussian curve. But this is no longer linear. That would be O (k * n), where k is the length of your average, which is also the length of the Gaussian.