Question: Question: 4 3 a. Consider the following code in C. The function Functionl is called from the main function which receives root of a binary

Question: 4 3 a. Consider the following code in C. The function Functionl is called from the main function which receives root of a binary search tree and the height function used in Functionl calculates the height of the tree. Function2 is called recursively and from Functionl. Now determine the output of the following BST using the below code. Functioni (tree) 9 1.for d = 1 to height(tree) +1 1.1. Function2 (tree, d); (17) Function2 (tree, level) 1.if tree is NULL then return; 6 22 2.if level is 1, then 2.1 print (tree->data); 3.else if level greater than 1, then 5 7 20 3.1 Function2 (tree->left, level-1); 3.2 Function2(tree->right, level-1); // Call the function from main function Functionl (root); b. Suppose you need to find the kth largest element in the Binary Search Tree. Explain the possible ways to find kth largest element from the tree given in question no 3(a). Your answer Question: 4 3 a. Consider the following code in C. The function Functionl is called from the main function which receives root of a binary search tree and the height function used in Functionl calculates the height of the tree. Function2 is called recursively and from Functionl. Now determine the output of the following BST using the below code. Functioni (tree) 9 1.for d = 1 to height(tree) +1 1.1. Function2 (tree, d); (17) Function2 (tree, level) 1.if tree is NULL then return; 6 22 2.if level is 1, then 2.1 print (tree->data); 3.else if level greater than 1, then 5 7 20 3.1 Function2 (tree->left, level-1); 3.2 Function2(tree->right, level-1); // Call the function from main function Functionl (root); b. Suppose you need to find the kth largest element in the Binary Search Tree. Explain the possible ways to find kth largest element from the tree given in question no 3(a). Your
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
