Skip to content
Related Articles
Open in App
Not now

Related Articles

GATE | GATE CS 2010 | Question 65

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 28 Jun, 2021
Improve Article
Save Article

In a binary tree with n nodes, every node has an odd number of descendants. Every node is considered to be its own descendant. What is the number of nodes in the tree that have exactly one child?
(A) 0
(B) 1
(C) (n-1)/2
(D) n-1

Answer: (A)

Explanation: It is mentioned that each node has odd number of descendants including node itself, so all nodes must have even number of descendants 0, 2, 4 so on. Which means each node should have either 0 or 2 children. So there will be no node with 1 child. Hence 0 is answer.

Following are few examples.

    /    \
   b      c

    /   \
   b     c  
  /  \
 d    e

Such a binary tree is full binary tree (a binary tree where every node has 0 or 2 children).

Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!