Binary Search Trees
In this lab your goal is to implement standard operations on binary search trees, including insert and delete. See section 12.3 in the textbook. In this assignment the keys are integers.
The input contains one of the following commands on a line:
- i key Insert key into the BST. For example, i 2 means Insert key 2 into the BST.
- d key Delete key from the BST. For example, d 2 means Delete key 2 from the BST. Do nothing if the BST does not contain the key.
- pre Output all keys in preorder.
- post Output all keys in postorder.
- in Output all keys in inorder.
- e Finish your program.
Reviews
There are no reviews yet.