Skip to content
Related Articles

Related Articles

Improve Article
GATE | GATE-CS-2017 (Set 1) | Question 17
  • Last Updated : 15 Feb, 2018

Let T be a binary search tree with 15 nodes. The minimum and maximum possible heights of T are:

Note: The height of a tree with a single node is 0.
(A) 4 and 15 respectively
(B) 3 and 14 respectively
(C) 4 and 14 respectively
(D) 3 and 15 respectively

Answer: (B)


  • The minimum height of a binary search tree will be when tree is full complete tree:


    Now, let h be the height of the binary tree, then, 2^{0}+2^{1}+2^{2}+2^{3}+…+2^{h}=2^{h+1}-1 <= n
    So, Min height of a binary search tree = log2(n+1) – 1 = log2(15+1) – 1 = 4 – 1 = 3

  • The maximum height of a binary search tree will be when the tree is fully skewed: (like below)


    Max height of the binary search tree = n-1 = 15 – 1 = 14, where the tree is Skewed tree

Therefore, option B 

Quiz of this Question

Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :