Make the histogram clustering function more generic.

Change the template parameter to be the histogram class
instead of the alphabet size of the histogram.