Question
Implement insert() in tree.cpp and show the results of inserting 2, 1, 4, 5, 9, 3, 6, 7, 10, 12, 11 into an empty Binary
Implement insert() in tree.cpp and show the results of inserting 2, 1, 4, 5, 9, 3, 6, 7, 10, 12, 11 into an empty Binary search tree. 2.Start with the tree in problem 1 and implement delete_node() and do: 2.1.delete 4, then 2.2.delete 9. 3.Start with the tree in problem 2 and implement search() and do: 3.1.Search 12 3.2.Search 4
#include
using std::cout; using std::endl;
class Node { int value; public: Node* left; // left child Node* right; // right child Node* p; // parent Node(int data) { value = data; left = NULL; right = NULL; p = NULL; } ~Node() { } int d() { return value; } void print() { std::cout << value << std::endl; } };
int main(int argc, const char * argv[]) { }
function insert(Node *insert_node, Node *tree_root){ //Your code here }
function delete_node(int value, Node *tree_root){ //Your code here }
function search(int value, Node *tree_root){ //Your code here }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started