Question: A binary search tree(BST) relies on the property that keys that are less than the parent are found in the left subtree, and keys that

A binary search tree(BST) relies on the property that keys that are less than the parent are found in the left subtree, and keys that are greater than(or equal) the parent are found in the right subtree. Implement a BST with the following basic components:

a. Create a BST for a list of data)[use insert(value) function] (4, 2, 10, 5, 8, 12, 11, 4, 9, 15, 6, 12, 7, 15)

b. Print the values in in-order, preorder, and post order

c. Check if the BST is balanced BST or not. If not, transform it a balanced BST

d. Write delNode(val) function to delete anode from the BST and then print the remaining BST content in in-order.

e. Create a max heap with the data in the initial BST above.

f. Delete a node from the heap. Make sure that the remaining data stays in a valid heap and print the remaining heap content.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!