Question: a. Consider the following code in C. The function Function1 is called from the main function which receives root of a binary search tree
a. Consider the following code in C. The function Function1 is called from the main function which receives root of a binary search tree and the height function used in Function1 calculates the height of the tree. Function2 is called recursively and from Function1. Now determine the output of the following BST using the below code. (9) Function1 (tree) 1. for d=1 to height (tree) +1 1.1. Function2 (tree, d); Function2 (tree, level) 1. if tree is NULL then return; 2.if level is 1, then 2.1 print (tree->data); 3.else if level greater than 1, then 3.1 Function2 (tree->left, level-1); 3.2 Function2 (tree->right, level-1); // Call the function from main function Function1 (root); 3 (5 6 7 (17) (22) (20)
Step by Step Solution
3.45 Rating (148 Votes )
There are 3 Steps involved in it
The C code for the above algorithm struct Node int data data val ... View full answer
Get step-by-step solutions from verified subject matter experts
