Question: add an option for creating a balanced BST from an array of char , such that the medium value in the array is the root
add an option for creating a balanced BST from an array of char, such that the medium value in the array is the root of the tree, and the left and right subtrees have same number of nodes...
TreeType::TreeType (ItemType items[], int len) { //Initialize the tree (binary search tree) with items given in the // array (length of the array is passed as "len" // You need to make the tree so that it's height is as short as possible // You should consider calling a recursive function to do so } // in main() main() { ... case 'O': //declare earler in main... char words[26]; cout <<"Enter a string..."; cin >> words; //sort the char array (using bubble sort or selection sort) //call the above constructor function of TreeType to build the optimal BST tree (the implementation of the member function shall make use of a recursive function): break;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
