Question: Write a program that inserts the following numbers into an initially empty BST such that the tree produced is equivalent to binary search tree. 50
Write a program that inserts the following numbers into an initially empty BST such that the tree produced is equivalent to binary search tree.
50 30 25 75 82 28 63 70 4 43 74
Hint: Put the median at the root and recursively build the left and right subtree. Median Formula: (n+1)/2
- Implement a function which, given a node in this binary search tree, prints out the maximum depths of its left and right subtrees.
- Implement a function to find the maximum value of all the nodes in the tree.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
