Question 13Asked in UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)

Suppose you are given a binary tree with n nodes, such that each node has exactly either zero or two children. The maximum height of the tree will be n − n…

Suppose you are given a binary tree with n nodes, such that each node has exactly either zero or two children. The maximum height of the tree will be n − n + 1 1
  1. An/2 – 1
  2. Bn/2 + 1
  3. C(n – 1)/2
  4. D(n + 1)/2
Show answerHide answer

Correct answer: (C) (n – 1)/2

Explanation

In a full binary tree (each node has 0 or 2 children) with n nodes, the number of internal nodes is I = (n – 1)/2. When the tree is skewed (each internal node has one leaf child), every internal node adds one level, so the maximum height is also (n – 1)/2.

From UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions)

This is question 13 of UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions). 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.