Question: 3. The following functions construct a binary search tree from a sorted array typedef struct _Tnode f 1 int info; struct _Tnode *left; struct _Tnode


3. The following functions construct a binary search tree from a sorted array typedef struct _Tnode f 1 int info; struct _Tnode *left; struct _Tnode *right; 4 5 Tnode; 7 Tnode *Tnode construct (int info) Tnode *node-malloc (sizeof (*node)); if (nodeNULL) 10 fprintf (stderr, "can 't get memory "); return NULL; 13 node->info - info; node->left node->right NULL; return node; 15 > 17 18 19 20 Tnode *BST build (int *array, int lb, int ub,) if (lb > ub return NULL; 23 24 25 26 27 28 29 30 int mid (lb + ub ) /2 ; Tnode *nodeTnode_construct (array[mid]); if (nodeNULL) return NULL; node->leftBST build (array, lb, mid - 1); node->right BST-build(array, mid + 1, ub); return node; 32 Consider the statements in the main function: int array[] = {1, 3, 5, 7, 9, 11, 13, 15); 34 35 int array_size - sizeof (array)/sizeof (array [0]); Tnode *bstBST build (array, 0, array_size - 1); Draw the computation tree that corresponds to the function call BST build(array, 0, array.size 1). You should show the last two parameters of the recursive function BST build in each node of the computation tree Draw the binary search tree constructed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
