Chapter 16 Questions
12. In the class BinaryNodeTree, the protected method inorder has a parameter visit. What is the
specification for this parameter?
a. virtual
b. value
c. reference
d. dummy
13. To save a binary search tree in a file and then restore it to its original shape, what type of
traversal should be used?
a. postorder
b. inorder
c. reorder
d. preorder
14. To remove a leaf in a binary search tree, what must be done?
a. set the pointer in the leaf’s parent to nullptr
b. set the pointer in the leaf to nullptr
c. set the pointer in the root to nullptr
d. delete the data from the leaf
15. If node N is being removed from a binary search tree and has a left child, what must be done
if P is the parent of N?
a. let the left child of N adopt P
b. let P adopt the left child of N
c. store the data of the left child of N in N
d. store the data of N in P
16. If a file contains items in a specified order, how must they be added to put them into a binary
search tree in that same order?
a. use the method addInOrder
b. use the method inOrderAdd
c. use the method add
d. use the method reOrderAdd
17. What efficiency is the tree sort in the average case?
a. O(n)
b. O(log2 n)
c. O(n2)
d. O(n * log n)