Question: 3) Use the pre-defined data structure (Node) and the six functions given below to complete the InsertNode function (15%). struct Node { int data; Node*

 3) Use the pre-defined data structure (Node) and the six functionsgiven below to complete the InsertNode function (15%). struct Node { int

3) Use the pre-defined data structure (Node) and the six functions given below to complete the InsertNode function (15%). struct Node { int data; Node* left; Node* right; int Height(Node* root) { if (root = NULL) return 0; return max(Height(root->left), Height(root->right)) + 1; int HeightDifference(Node* root) { return Height(root->left) - Height(root->right); void RotateL(Node* & root) { Node *p = root->right; root->right = p->left; p->left = root; root = p; void RotateR(Node*& root) { Node *p = root->left; root->left = p->right; p->r = root; root = p; void RotateLR(Node* & root) { RotateL(root->left); RotateR(root); void RotateRL(Node*& root) { RotateR(root->right); RotateL(root);void InsertNode(Node* & root, int x) { // write your answer below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!