Question: 7) Redraw the following BST after execution of the code given below. void UpdateTree() { if (root != nullptr) { Node n1 = nullptr;

7) Redraw the following BST after execution of the code given below. void UpdateTree() { if (root != nullptr) { Node n1 = nullptr; Update Tree (root, &n1); root = n1; } } void Update Tree (Node* curr, Node** n1) { if (curr->left != nullptr) Update Tree (curr->left, n1); curr->left = *n1; if (*n1 != nullptr) (*n1)->right = curr; *n1 = curr; if (curr->right != nullptr) Update Tree (curr->right, n1); } root 41 30 65 21 36 59 59 27
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
