You have been given a recursive routine to multiply the values of all keys in a
ID: 3817443 • Letter: Y
Question
You have been given a recursive routine to multiply the values of all keys in a BST: int findProduct(TreeNode * root) {if(root 1= NULL) {return findProduct(root->left)* root->key * findProduct(root->right);} else return 1;} Consider following binary search tree for both the questions: What is the order that the nodes values are included in the following recursive function? b] Nodes evaluated in a BST search for a specified value: For the above example of Binary Search Tree, show the order that nodes are evaluated in searching for X. You do not need to include any node that is NULL. Select all that apply from a list and put the evaluation order in the box next to it. means evaluate the node with a key value of 0017 first. The BST is here, we want to search X=0009:Explanation / Answer
a) 2 5 9 12 14 15 17 23 26 28
This is same as inorder traversal as we are traversing as left, root, right
b)
0017 1 0014 2 0005 3 0012 4 0009 5Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.