Abstract. The weighted path length of optimum binary search trees is bounded above by Y'./3i + 2 a. + H where H is the entropy of the frequency distribution, /3i is the total weight of the internal nodes, and aj is the total weight of the leaves. This bound is best possible. A linear time algorithm for constructing nearly optimal trees is described. Key words, binary search tree, complexity, average search time, entropy One of the popular methods for retrieving information by its "name" is to store the names in a binary tree. We are given n names B1, Be, , Bn and 2n + 1 frequencies 1," ", fin, aO," ", an with /3i + Y aj 1. Here ji is the frequency of encountering name Bi, and aj is the frequency of encountering a name which lies between B and B/I, a0 and an have obvious interpretations [4] . A binary search tree T for the names B1, B2, , Bn is a tree with n interior nodes (nodes having two sons), which we denote by circles, and n + 1 leaves, which we denote by squares. It is equal to the expected number of comparisons needed to retrieve a name. In [4] D. E. Knuth gives an algorithm for constructing an optimum binary search tree, i.e., a tree with minimal weighted path length. His algorithm operates in O(n 2) units of time and O(n2) units of space. In [6] we discuss the following "rule of thumb" for constructing nearly optimal binary search trees: choose the root so as to equalize the total weight of the left and right subtree as much as possible, then proceed recursively. The The rule presented here as well as the rules described in [6] can be implemented to work in linear time and space ([2]).
Mehlhorn REF gave an O(n) time algorithm to build a binary search tree that is near-optimal.
A Best Possible Bound for The Weighted Path Length of Binary Search Trees
SIAM J. Comput.
SIAM J. Comput.
Mathematics Computer Science