Ranking the Best Binary Trees

The problem of ranking the K-best binary trees with respect to their weighted average leaves’ levels is considered. Both the alphabetic case, where the order of the weights in the sequence $w_1 , \cdots ,w_n $ must be preserved in the leaves of the tree, and the nonalphabetic case, where no such restriction is imposed, are studied.For the alphabetic case a simple algorithm is provided for ranking the K-best trees based on a recursive formula of complexity $O(Kn^3 )$. For nonalphabetic trees two different ranking problems are considered, and for each of them it is shown that the next best tree can be solved by a dynamic programming formula of low complexity order.