Open In App

GATE | GATE CS 2010 | Question 65

Like Article
Like
Save
Share
Report

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.

       a
    /    \
   b      c


      a
    /   \
   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


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads