Question 16343 – UPPCL AE 2022
November 24, 2023
Question 3440 – Research Aptitude
November 24, 2023
Question 16343 – UPPCL AE 2022
November 24, 2023
Question 3440 – Research Aptitude
November 24, 2023

Binary-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 _____________;
              } 
A
Theory Explanation is given below.
Correct Answer: A
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!