Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) What is the output of the function call f(root) where f is the function shown

ID: 3545749 • Letter: 1

Question

1) What is the output of the function call f(root) where f is the function shown below and root is a pointer to the root of the tree shown below? (Note: use the struct defintion from the two previous questions.)

void f(struct treeNode* root) {

if (root == NULL) return 0;

if (root->left == NULL && root->right -- NULL)

return root->data;

int left= f(root->left); int right = f(root->right); return left + right;

}

                                         root_______

                                                             |

                                                            30

                                                          /      

                                                       20      15

                                            /      /

                                         5  37  17

                                       /          /   

                                      8        65  40

a) 0                   b) I5O               c) 153              d) 230              e) None of the Above


2) Inserting which of the values shown into the AVL tree shown below would cause a rebalancing operation?

30

I           

20         40

        I

22 35 50

37

a) 8                  b) 19                c) 32                 d) 36                e) None of the Above



3) What is the minimumnumber of nodes an AVL tree with height 5?

a) 7                  b) 10                 c) 12               d) 20                e) None of the Above




What is the output of the functioncall f(root) where f is the function shown below and root is a pointer to the rootof the treeshown below? (Note: use the struct defintion from the two previous questions.) Inserting which of the values shown into the AVL tree shown below would cause a rebalancing operation? What is the minimumnumber of nodes an AVL tree with height5?

Explanation / Answer

1   e> none of these 237

2   c> 32

3   e< none of thes 5