change in getHistogram function
compute the histograms for all the labels