Open In App

GATE | GATE-CS-2007 | Question 43

A complete n-ary tree is a tree in which each node has n 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

Answer: (C)
Explanation:

L=(K-1)*I+1

L=41

I=10

K=?

L=(K-1)*I+1

41=(k-1)*10+1

(k-1)*10=40

k-1=4

k=5 

See question 3 of https://www.geeksforgeeks.org/data-structures-and-algorithms-set-11/amp/
Quiz of this Question

Article Tags :