Question 16343 – UPPCL AE 2022
November 24, 2023Question 3440 – Research Aptitude
November 24, 2023Binary-search-tree
Question 6
|
(a) Insert the following keys one by one into a binary search tree in the order specified.
15, 32, 20, 9, 3, 25, 12, 1
Show the final binary search tree after the insertions.
(b) Draw the binary search tree after deleting 15 from it.
(c) Complete the statements S1, S2 and S3 in the following function so that the function computes the depth of a binary rooted at t.
typedef struct tnode{ int key; struct tnode *left, *right; } *Tree; int depth(Tree t) { int x,y; it (t == NULL) return0; x=depth(t → left); S1: ____________; S2: if(x>y) return _____________: S3: else return _____________; }
Theory Explanation is given below.
|
Correct Answer: A
Subscribe
Login
0 Comments