Answers to Self-Study Questions for BST

Test Yourself #1

Question #1

Tree 1 is not a BST because B is greater than A, yet B is in the left subtree of the node with key A (all keys in a node's left subtree should have keys that are less than the key in that node).
Tree 4 is not a BST because 20 is greater than 15, yet 20 is in the left subtree of the node with key 15.

Question #2

An in-order traversal of a BST prints the data out in sorted order.

Test Yourself #2

The BST that results from insertingn the values 5 3 7 6 2 1 4 in that order is: The BST that results from insertingn the values 1 2 3 4 5 6 7 in that order is: The BST that results from insertingn the values 4 3 5 2 6 1 7 in that order is:

Test Yourself #3