Smoothing of one and two-dimensional histograms with a diffusion algorithm