CSCI-UA 102 (Data Structures)

Binary (Search) Trees

Problem 1

Use lab10 IntBST workspace on Ed. Complete the four missing functions. Submit your final code to Gradescope to see if your implementation passes all the tests.

Remember to remove any debugging print statements before submitting.


(There is nothing to submit for the remaining problems in this lab.)

Problem 2

a tree

Problem 3

a tree

Problem 4

You are told that the preorder and postorder traversals of a given tree are as follows:

preorder: A B C D E F G H I

postorder: C E D B H G I F A

Construct a tree for which this is the case.

Problem 5

a tree

Starting with the binary search tree shown above, show what the tree will look like after each of the following operations. Assume that the remove method uses the successor when applicable. For each step modify the original tree (not the tree from the step before).

Problem 6

Use the following tree to answer questions below

a tree

Problem 7

Use the following tree to answer questions below

a tree