[Show with no answers] [Show with all answers]
Show how a Splay tree would be constructed if the following values were inserted into an initially empty tree in the order given:
5 3 8 7 4
Let \( t \) be your answer to part a, and consider the following sequence of operations:
SearchSplay (t, 7); SearchSplay (t, 8); SearchSplay (t, 6);
Show the tree after each operation.
Answer the following question without the help of the treeLab program from the lecture.
Show how an AVL tree would be constructed if the following values were inserted into an initially empty tree in the order given:
12 10 8 6 4 2
Show how a 2-3-4 tree would be constructed if the following values were inserted into an initially empty tree in the order given:
1 2 3 4 5 8 6 7 9 10
Once you have built the tree, count the number of comparisons needed to search for each of the following values in the tree:
1 7 9 13
Implement the following function
that prints the height difference
between the left subtree and the right subtree
of every node in a given binary tree,
(BSTree t
).
The function returns the height of a given binary tree.
Use the following function interface:
int printHeightDiff (BSTree t) { ... }