Question: Assignment# 5 Write a program to take a given binary search tree and make the first balance to that tree by finding the median of
Assignment#
Write a program to take a given binary search tree and make the first balance to that tree by finding the median of the data and make it as root then put all values less than it in left side and all values greater than it to the right side.
Hint: read the BST using in order traversal and store it in an array then you can pick the median and the numbers less than it and the numbers greater than it to rebuild the new BST
Use recursion to apply the same thing to the left side of the tree and to the right side of the tree to make it complete BST by java app
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
