Data-Structures
November 15, 2023
Question 8932 – Compiler-Design
November 15, 2023
Data-Structures
November 15, 2023
Question 8932 – Compiler-Design
November 15, 2023

Data-Structures

Question 40

A complete n-ary tree is one in which every node has 0 or n sons. If x is the number of internal nodes of a complete n-ary tree, the number of leaves in it is given by

A
x(n-1) + 1
B
xn – 1
C
xn + 1
D
x(n+1)
Question 40 Explanation: 
No. of internal node = x
Let no. of leaf nodes = L
Let nt be total no. of nodes.
So, L+x = nt —–(I)
Also for n-ary tree with x no. of internal nodes, total no. of nodes is,
nx+1 = nt —–(II)
So, equating (I) & (II),
L+x = nx+1
L = x(n-1) + 1
Correct Answer: A
Question 40 Explanation: 
No. of internal node = x
Let no. of leaf nodes = L
Let nt be total no. of nodes.
So, L+x = nt —–(I)
Also for n-ary tree with x no. of internal nodes, total no. of nodes is,
nx+1 = nt —–(II)
So, equating (I) & (II),
L+x = nx+1
L = x(n-1) + 1

Leave a Reply

Your email address will not be published. Required fields are marked *