The number of leaf nodes in a rooted tree of n nodes, with each node having 0 or 3 children is:
(A) n/2
(B) (n-1)/3
(C) (n-1)/2
(D) (2n+1)/3
Answer: (D)
Explanation: Let L be the number of leaf nodes and I be the number of internal nodes, then following relation holds for above given tree (For details, please see question 3 of this post)
L = (3-1)I + 1 = 2I + 1
Total number of nodes(n) is sum of leaf nodes and internal nodes
n = L + I
After solving above two, we get L = (2n+1)/3
Quiz of this Question
Recommended Posts:
- Introduction to Data Structures | 10 most commonly used Data Structures
- Data Structures | Binary Trees | Question 1
- Data Structures | Binary Trees | Question 15
- Data Structures | Binary Trees | Question 3
- Data Structures | Binary Trees | Question 15
- Data Structures | Binary Trees | Question 6
- Data Structures | Binary Search Trees | Question 1
- Data Structures | Binary Search Trees | Question 2
- Data Structures | Balanced Binary Search Trees | Question 2
- Data Structures | Binary Search Trees | Question 3
- Data Structures | Binary Search Trees | Question 4
- Data Structures | Binary Search Trees | Question 5
- Data Structures | Balanced Binary Search Trees | Question 2
- Data Structures | Binary Trees | Question 9
- Data Structures | Binary Trees | Question 10
- Data Structures | Binary Trees | Question 11
- Data Structures | Binary Search Trees | Question 6
- Data Structures | Binary Trees | Question 12
- Data Structures | Binary Trees | Question 13
- Data Structures | Binary Search Trees | Question 7

