Simple BinarySearch Tree Class Write a class for implementing a simple binary search tree capable of storing numbers. The class should have member functions
void insert(double x)
bool search(double x)
void inorder(vector & v )
The insert function should not use recursion directly or indirectly by calling a recursive function. The search function should work by calling a private recursive member function
bool search(double x, BtreeNode *t)
The inorder function is passed an initially empty vector v: it fills v with the inorder list of numbers stored in the binary search tree. Demonstrate the operation of the class using a suitable driver program.
2.
Tree SizeSolving the Tree Size Problem Modify the binary search tree created in the previous programming challenge to add a member function
int size()
that returns the number of items (nodes) stored in the tree. Demonstrate the correctness of the new member function with a suitable driver program.
3.
Leaf CounterModify the binary search tree you created in the preceding programming challenges to add a member function
int leafCount()
that counts and returns the number of leaf nodes in the tree. Demonstrate that the function works correctly in a suitable driver program.
4.
Tree HeightModify the binary search tree created in the preceding programming challenges by adding a member function that computes and returns the height of the tree.
int height()
The height of the tree is the number of levels it contains. For example, the tree shown in Figure below has three levels. Demonstrate the function with a suitable driver program. Figure below A Binary Tree with Three Levels A binary tree shows a root node with 2 child nodes. Each child node shows one child.
5.
Tree WidthModify the binary search tree created in the preceding programming challenges by adding a member function that computes the width of the tree.
int width()
The width of a tree is the largest number of nodes at the same level. Demonstrate correctness in a suitable driver program.
6.
Tree Copy ConstructorDesign and implement a copy constructor for the binary search tree created in the preceding programming challenges.
Use a driver program to demonstrate correctness.
7.
Tree Assignment OperatorDesign and implement an overloaded assignment operator
for the binary search tree created in the preceding programming challenges.