N-ary tree – Data structure

N-ary tree – Data structure

Question 1 UGC NET June-2020
A complete n-ary tree is a tree in which nodes have children or no children. Let I be the number of internal nodes and L be the number of leaves in a complete n-ary tree. If L=41, and I=10, what is the value of n?
A – 3
B – 4
C – 5
D – 6

Show Answer With Best Explanation

Answer : C
Explanation:
L = (n-1) * I + 1
where,
L = Leaf Node, I = Internal Node, n = n-arry Tree
L = (n-1)*I +1
41 = (n-1) * 10 +1
41 = 10n -10 +1
10n = 50
n = 5


error: Content is protected !!
Open chat
1
Hi,how Can We Help You ?