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
Recommended Posts:
- GATE | GATE CS 2010 | Question 1
- GATE | GATE CS 2010 | Question 2
- GATE | GATE CS 2010 | Question 3
- GATE | GATE CS 2010 | Question 4
- GATE | GATE CS 2010 | Question 5
- GATE | GATE CS 2010 | Question 65
- GATE | GATE CS 2010 | Question 8
- GATE | GATE CS 2010 | Question 65
- GATE | GATE CS 2010 | Question 10
- GATE | GATE CS 2010 | Question 11
- GATE | GATE CS 2010 | Question 13
- GATE | GATE CS 2010 | Question 14
- GATE | GATE CS 2010 | Question 15
- GATE | GATE CS 2010 | Question 16
- GATE | GATE CS 2010 | Question 65
- GATE | GATE CS 2010 | Question 18
- GATE | GATE CS 2010 | Question 19
- GATE | GATE CS 2010 | Question 20
- GATE | GATE CS 2010 | Question 21
- GATE | GATE CS 2010 | Question 22

