On the Complexity of Recursive Tree-Based Algorithms for Computing Distance Histograms