A Best Possible Bound for the Weighted Path Length of Binary Search Trees

نویسنده

  • Kurt Mehlhorn
چکیده

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. 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. The interior nodes are labeled with the B in increasing order from left to right and the leaves are labeled with the intervals (Bi, B//I) in increasing order from left to right. Let b be the distance of interior node B from the root and let aj be the distance of leaf (Bi, Bi/I) from the root. To retrieve a name X, bi + 1 comparisons are needed if X B and ai comparisons are required if Bi < X < Bj/a. Therefore we define the weighted path length of tree T as: P= i bi .-I-1) + c,a,. i=1 ]=0 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 weighted path length of a tree constructed according to this rule is bounded above by 2+1.44.H, where H= Y fli log (1/fli)+ ce log (1/at) is the entropy of the frequency …

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Best possible bounds for the weighted path length of optimum binary search trees

We derive upper and lower bounds for the weighted path length P opt of optimum binary search trees. In particular, I/Iog3 H S Popt ~ 2 + H where H is the entropy of the frequency distribution. We also present an approximation algorithm which constructs nearly optimal trees.

متن کامل

Extremal Weighted Path Lengths in Random Binary Search Trees

We consider weighted path lengths to the extremal leaves in a random binary search tree. When linearly scaled, the weighted path length to the minimal label has Dickman’s infinitely divisible distribution as a limit. By contrast, the weighted path length to the maximal label needs to be centered and scaled to converge to a standard normal variate in distribution. The exercise shows that path le...

متن کامل

Tight Upper and Lower Bounds on the Path Length of Binary Trees

The external path length of a tree T is the sum of the lengths of the paths from the root to each external node. The maximal path length diierence, , is the diierence between the length of the longest and shortest such path. We prove tight lower and upper bounds on the external path length of binary trees with N external nodes and prescribed maximal path length diierence. In particular, we give...

متن کامل

Expected Shape of Random Binary Search Trees

This entry contains proofs for the textbook results about the distributions of the height and internal path length of random binary search trees (BSTs), i. e. BSTs that are formed by taking an empty BST and inserting elements from a fixed set in random order. In particular, we prove a logarithmic upper bound on the expected height and the Θ(n log n) closed-form solution for the expected interna...

متن کامل

ISA[ k ] Trees: a Class of Binary Search Trees with Minimal or Near Minimal Internal Path Length

In recent years several authors have investigated binary search trees with minimal internal path length. In this paper we propose relaxing the requirement of inserting all nodes on one level before going to the next level. This leads to a new class of binary search trees called ISA[k] trees. We investigated the average locate cost per node, average shift cost per node, total insertion cost, and...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • SIAM J. Comput.

دوره 6  شماره 

صفحات  -

تاریخ انتشار 1977