AbstractIn this paper we solve the following problem: Given a positive integer f and L weights (real numbers), find a partition with f classes of the multiset of weights such that the sum of the costs of the optimum m-ary Huffman trees built for every class of is minimum. An application to the optimal extendibility problem for prefix codes is proposed. 1.)This work was done while the author has visited the Computer Science Department, University of Auckland, New Zealand.