  We solve a class of optimization problems for (phylogenetic) $X$-trees or
their shapes. These problems have recently appeared in different contexts, e.g.
in the context of the impact of tree shapes on the size of TBR neighborhoods,
but so far these problems have not been characterized and solved in a
systematic way. In this work we generalize the concept and also present several
applications. Moreover, our results give rise to a nice notion of balance for
trees. Unsurprisingly, so-called caterpillars are the most unbalanced tree
shapes, but it turns out that balanced tree shapes cannot be described so
easily as they need not even be unique.
