In this paper, the construction of nearly optimal multiway trees for n keys, n key weights, and n + 1 gap weights, is investigated. we present an efficient algorithm for this problem having a time complexity of O(H t n), where H is the height of the resulting tree and t is its order. The algorithm is based on a top down approach. For a given set of keys, we determine a subset of keys that should stay in the root. This leads to equal subproblems of smaller size. For the determination of the root keys, we use a variant of the concave least-weight subsequence problem that can be solved in linear time. Computational experiments have always yielded trees for which the weighted path length is not more than two percent above the optimal weighted path length.