
Date: December 4, 2020
RUTGERS UNIVERSITY
The State University of New Jersey
School of Engineering
Department of Electrical and Computer Engineering
14:332:351 Programming Methodology – II Fall 2004
Trees
1. An In-order tree walk of an n-node binary search tree can be implemented by finding the
minimum element in the tree with TREE-MINIMUM and then making n-1 calls to TREE-
SUCCESSOR. Prove that this algorithm runs in O(n) time.
2. Prove that no matter what node we start at in a height-h binary search tree, k successive calls
to TREE-SUCCESSOR take O(k + h) time.
3. Is the operation of deletion “commutative” in the sense that deleting x and then y from a
binary search tree leaves the same tree as deleting y and then x? Argue why it is or give a
counter-example.
4. Construct the binary search tree corresponding to:
Pre-order sequence: ABCDEFGHI
In-order sequence: BCAEDGHFI
5. You are given the Pre-order and the Post-order sequences of a binary search tree. Argue
whether they lead to a unique tree. Use induction to begin from a small tree and generalize to
an arbitrary tree.
Note:
1. We will have more to say about trees when we cover B-Trees, B+-Trees, Red-Black Trees
and AVL-Trees. These trees have the “balanced height” property. You need not memorize or
do detailed reading on this. In-fact we will only touch these topics.
2. Decision Trees will provide us lower bounds on comparison based sorting/searching
methods.
3. Parse Trees will be introduced in your first programming assignment.
Page 1 of 1
Readings:
Read Ch 13 (Binary Search Trees) from Cormen et al before next lecture.
Read about “Threaded Binary Trees” from Sahni.