A programmer proposes four separate insertions into the binary search tree shown. Consider each proposal independently, starting from the original tree, and leave every existing node in place. Select every insertion that preserves the strict BST ordering with distinct keys.
Insert 747474 as the right child of 585858, leaving all existing nodes in place.
Insert 626262 as the right child of 585858, leaving all existing nodes in place.
Insert 414141 as the left child of 494949, leaving all existing nodes in place.
Insert 434343 as the right child of 353535, leaving all existing nodes in place.
Unlock full course notes by signing up
How Insertion Order Sets the Height
Ten distinct integer keys are inserted, one at a time and with no rebalancing, into an initially empty binary search tree in this order:
50, 30, 70, 20, 40, 60, 80, 45, 47, 65
Take the height of a tree to be the number of edges on its longest root-to-leaf path, and count one key comparison for each node visited during a search. Give each answer as a whole number.
Two Deletions with Successor Replacement
A database index uses the binary search tree shown. Delete key 525252, then delete key 686868 from the resulting tree. Whenever the deleted node has two children, use its inorder successor as the replacement key. Remove the successor from its original position and reconnect any right child it has. Do not rebalance the tree.
After both deletions, report the root key, the key of the parent of 646464, and the total number of remaining nodes. Give all three answers as exact integers.
Successor, Predecessor, Floor and Ceiling
The binary search tree below was built by inserting the keys 41, 20, 65, 11, 29, 50, 91, 26, 32, 55, 72 and 99 in that order. For a value xxx that need not be in the tree, the floor of xxx is the largest key in the tree that is less than or equal to xxx, and the ceiling of xxx is the smallest key in the tree that is greater than or equal to xxx.
Fill in each key. The in-order successor of 32 is ________, the in-order predecessor of 72 is ________, the floor of 60 is ________, and the ceiling of 23 is ________.