CHAPTER 3 Searching
EXERCISES (continued)
3.3.12 Draw the red-black BST that results after each transformation (color flip o
rotation) during the insertion of P for our standard indexing client.
3.3.13 True or false: If you insert keys in increasing order into a red-black BST, the tree
height is monotonically increasing.
3.3.14 Draw the red-black BST that results when you insert letters A through K in order
into an initially empty tree, then describe what happens in general when trees are built
by insertion of keys in ascending order (see also the figure in the text).
3.3.15 Answer the previous two questions for
the case when the keys are inserted in descend-
ing order.
3.3.16 Show the result of inserting n into the
red-black BST drawn at right (only the search
path is shown, and you need to include only
these nodes in your answer).
3.3.17 Generate two random 16-node red-
black BSTs. Draw them (either by hand or
with a program). Compare them with the
(unbalanced) BSTs built with the same keys.
3.3.18 Draw all the structurally different red-black BSTs with n keys, for n from 2 up
to 10 (see EXERCISE 3.3.5).
3.3.19 With 1 bit per node for color, we can represent 2-, 3-, and 4-nodes. How many
bits per node would we need to represent 5-, 6-, 7-, and 8-nodes with a binary tree?
3.3.20 Compute the internal path length in a perfectly balanced BST of n nodes, when
n is a power of 2 minus 1.
3.3.21 Create a test client for RedBlackBST based on your solution to EXERCISE 3.2.10.
3.3.22 Find a sequence of keys to insert into a BST and into a red-black BST such that
the height of the BST is less than the height of the red-black BST, or prove that no such
sequence is possible.