Question 69

For a tree with just one node, the root node is the height of a binary tree is defined to zero; if there are 2 levels of nodes, the height is 1 and so on.

For a tree with just one node, the root node is the height of a binary tree is defined to zero; if there are 2 levels of nodes, the height is 1 and so on. A Binary Search Tree is built according to the usual rules with the following six key inserted one at a time as given : B, I, N, A, R, Y. What is the height of the tree?
  1. A5
  2. B2
  3. C3
  4. D4
Show answerHide answer

Correct answer: (D) 4

Explanation

Inserting B, I, N, A, R, Y gives root B with A on the left and the chain I → N → R → Y to the right. The longest path B-I-N-R-Y has 4 edges, so the height is 4.

From DSSSB TGT Computer Science Practice Set 2

This is question 69 of DSSSB TGT Computer Science Practice Set 2. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.