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

Can someone please tell me which anser is the correct one for question 9 and 10?

ID: 3824050 • Letter: C

Question

Can someone please tell me which anser is the correct one for question 9 and 10? It's C programming

Question 9 void printnode (Tree node Node printf ("3d (int) (node- value) prints the value of node printnode (node- left printnode (node- right) prin tnode (root) The above code is o a post-order traversal of the tree starting at root and prints all the values but not in order. O a pre-order traversal of the tree starting at root and prints all the values in order. O a pre-order traversal of the tree starting at root and prints all the values but not in order o a post-order traversal of the tree starting at root and prints all the values in order O an in-order traversal of the tree starting at root and prints all the values but not in order O an in-order traversal of the tree starting at root and prints all the values in order. Question 10 When using an array to represent a tree, the formula to find the left child of a node at index i is left child index 2i 1 o left child index 2i 2 O left child index (i 1)/2 o left child index 3log2 +1)

Explanation / Answer

1) This is pre order traversal as pre- order traversal is Root, Left ,Right
So here it gets Root (so it prints its value) then calls the same function with left subtree now the whole left subtree will be printed using the same preorder rule.
Then it will call function printNode for right subtree and everything will be printed for right subtree using pre - order traversal rule.
So right option is PreOder and print all values in order.

2) In aray based implementation the root is considered at 0th index and left chil of node at index i is 2*i+1