Question: C++ LAB Code a TreeNode Class which contains two TreeNode pointers and an integer data member. also Code a Binary Search Tree class for integers,

C++ LAB Code a TreeNode Class which contains two TreeNode pointers and an integer data member. also Code a Binary Search Tree class for integers, implement the following public interface: BinarySearch Tree(); Il constructor void add(int toadd); // both the add and height methods are int height(). Il implemented by a private recursive method| Code the main program which adds several integers to a binary tree and prints the height of the tree. Note: You will have two add and two height methods, one public and one private. So for example, you need to provide an extra private method add(TreeNode *toAdd, TreeNode *addHere) to call recursively. Note: For a tree with just one node, the root node, the height is defined to be 0, if there are 2 levels of nodes the height is 1 and so on. A null tree (no nodes except the null node) is defined to have a height of -1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
