Question 9974 – Data-Structures
November 15, 2023Question 8932 – Compiler-Design
November 15, 2023Question 9997 – Data-Structures
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
Correct Answer: A
Question 22 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
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
x(n-1) + 1
xn – 1
xn + 1
x(n+1)
Subscribe
Login
0 Comments