Question: 5.Given the binary search tree below, show the order that nodes are evaluated in searching for a value of 45. You do not need to

5.Given the binary search tree below, show the order that nodes are evaluated in searching for a value of 45. You do not need to include any node that is NULL. You must write your answer in the order that the nodes are evaluated. For example, Order of nodes visited: Node 15 means to evaluate the node with a value of 15 first.5.Given the binary search tree below, show the order that nodes are

6.

You have been given a recursive function to sum the values of all keys in a BST:

int findSum(TreeNode * root, int depth) {
 if(root != NULL) {
 int leftSum = findSum(root->left, depth + 1);
 int rightSum = findSum(root->right, depth + 1);
 cout key;
 if (depth != 0)
 {
 cout  
 }
 return leftSum + rightSum + root->key; } else return 0; }

Consider following binary search tree: 15 / \ 12 17 / 4 / \ 2 5 \ 8

The following code is called:

findSum(root, 0);

Root is a pointer to the TreeNode whose key is 15. What is the output from cout? Note that there is a single space between values that are printed to the terminal. Note, there are no intended errors in the code.

evaluated in searching for a value of 45. You do not need

Given the binary search tree below, show the order that nodes are evaluated in searching for a value of 45. You do not need to include any node that is NULL. You must write your answer in the order that the nodes are evaluated. For example, Order of nodes visited: Node 15 means to evaluate the node with a value of 15 first. 15 60 30 70 20 50 40 45 Order of nodes visited: Node 15

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 Databases Questions!