We present fast new algorithms for evaluating trees with respect to least squares and minimum evolution (ME), the most commonly used criteria for inferring phylogenetic trees from distance data. These include: an optimal O(N² ) time algorithm for calculating the branch (edge) lengths on a tree according to ordinary or unweighted least squares (OLS); an O(N³ ) time algorithm for edge lengths under weighted least squares (WLS) and the FitchMargoliash method; and an optimal O(N⁴) time algorithm for generalised least squares edge lengths. The Minimum Evolution criterion is based on the sum of edge lengths. Consequently, the edge lengths algorithms presented here lead directly to O(N² ), O(N³ ) and O(N⁴) time algorithms ...