Question: Purpose: 1. Warm up your Java programming skills 2. Understand the structure and application of a binary search tree Task Description: Your program should read

Purpose: 1. Warm up your Java programming skills 2. Understand the structure and application of a binary search tree Task Description: Your program should read from the standard input a sequence of integer values, with each value separated by a space. Your task is to Build a binary search tree using these values in the order they are entered. Print 3 traversals: pre-, in-, and post-order. Allow the user to insert/delete a value. Once a new tree is generated, print it in-order Find predecessor of a given value. The predecessor is the node that appears right before the given value in an in-order traversal. Find successor of a given value. The successor is the node that appears right after the given In your BST implementation, the add and delete methods must be implemented using recursion. You will lose major points for using a non-recursive implementation. Note that no duplicates are allowed in this BST. Your program should use an interactive interface with the format shown below (the user inputs are underlined) % java Project! Please enter the initial sequence of values Pre-order: XXX X In-order: XXX... X Post-order: XXX... X Command? H I Insert a value D Delete a value P Find predecessor S Find successor E Exit the program H Display this message Command? I 88 In-order: XXX... X Command? I 42
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
