Binary search trees
1.[2p] The binary search tree property says that at every node ,
The binary search tree property says that at every node ,
2.[3p] Insert 41, 23, 67, 12, 35, 55, 88, 29 in that order. What is the height of the resulting tree, counting edges?
Insert 41, 23, 67, 12, 35, 55, 88, 29 in that order. What is the height of the resulting tree, counting edges?
3.[2p] Insert those same eight keys in ascending order instead. What is the height then?
Insert those same eight keys in ascending order instead. What is the height then?
4.[3p] Deleting a node with two children works by
Deleting a node with two children works by
5.[1p] An in-order traversal of a binary search tree emits its keys in ascending order.
An in-order traversal of a binary search tree emits its keys in ascending order.
6.[3p] For a million keys, an average successful search in a randomly built tree costs about comparisons. How many is that?
For a million keys, an average successful search in a randomly built tree costs about comparisons. How many is that?
7.[3p] Which of these are reasons the degenerate linear tree matters in practice?
Which of these are reasons the degenerate linear tree matters in practice?
Select all that apply
8.[3p] Match each operation to what it costs in a binary search tree of height holding keys.
Match each operation to what it costs in a binary search tree of height holding keys.
Search for one key
Find the minimum
List every key in order
Insert a new key
Show the answer
Search for one key: Find the minimum: List every key in order: Insert a new key:
9.[3p] Why is quicksort's average comparison count also the expected sum of node depths in a random tree?
Why is quicksort's average comparison count also the expected sum of node depths in a random tree?