Question: 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

 You have been given a recursive function to sum the values

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, depth1); int rightSum - findSum(root->right, depth1) cout key; if (depth 1-) cout keys else return ; Consider following binary search tree: 15 12 17 The following code is called: findSum(root, e); 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

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!