Question: // Basic notes on Binary Trees #include #include #include using namespace std ; class Node { public : int data; Node *left, *right; int findDepth
// Basic notes on Binary Trees#include#include #include using namespace std;class Node {public: int data; Node *left, *right; int findDepth(int); void report(void);};class BinaryTree {public: Node *root; int findDepth(int);};int main(void) { // Code here... return(0);}int BinaryTree::findDepth(int i) { if (root) return (root->findDepth(i)); else { return(-1); }};int Node::findDepth(int i) { if (i == data) return(0); int d; if (iif (left) d = left->findDepth(i); else d = -1; } if (i>data) { if (right) d = right->findDepth(i); else d = -1; } if (d == -1) return(-1); else return(d + 1);};void Node::report() { cout " "; if (right) right->report(); if (left) left->report();};

Using this given Person structure (Do Not Modify it). struct Person { string name; int age; Person(string angl, int arg2) { name : argl; age = angZ; } }; 1. Refactor the binary search tree code from class and HARD CODE this binary search tree sorted by name. (Remember that C++ is case sensitive.) 2. Refactor the report and print in order methods (or functions) to print the name and age of each person in the tree. JAIME / \\ H... \\ / \\ 2. Call the report and print in order functions to display the tree two ways. 3. Code an insert method (or function) that allows the user to insert a person dynamically at run time. 4. Call the report and print in order methods (or functions) to display the tree after the user inserts into the tree. Memory management would be nice but not required. Turn in one .cpp le with separation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
