Let TD be the set containing all the trees corresponding to a
given degree sequence D and let RF be the graph invariant
defined via RF=u∼v∑F(deg(u),deg(v)), where the summing is performed across all the unordered pairs of adjacent
vertices u and v, with F:N×N→R being a symmetric function such that
\mathcal{F}(x, a) + \mathcal{F}(y, b) > \mathcal{F}(y, a) + \mathcal{F}(x, b)
\quad \mbox{for any $x > y$ and $a > b$} . In an earlier paper, Wang [Cent.
Eur. J. Math. 12 (2014) 1656-1663] demonstrated that the greedy tree must
always attain the maximum RF value on TD, while an
alternating greedy tree necessarily attains the minimum RF value
on TD. In this paper, we implement an algorithmic approach in
order to find the full solution set to both the RF maximization
and RF minimization problem on TD. In other words, we
determine all the trees from TD that attain the maximum
RF value on this set, together with all the trees from
TD that minimize the said graph invariant, thereby improving the
aforementioned earlier result obtained by Wang