in DS recategorized by
3,715 views
1 vote
1 vote

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$?

  1. $3$
  2. $4$
  3. $5$
  4. $6$
in DS recategorized by
3.7k views

3 Answers

3 votes
3 votes
Let N be the total number of nodes.

N= n*I + 1, Also N= I+ L = 41+10 = 51

51=n*10+1

n=5

1 comment

CORRECT 👍
0
0
1 vote
1 vote
For strict n-ary trees the relationship between external(leaf) nodes and internal nodes is: $$L = (n-1)i + 1$$

Using this formula, L = $41$ , i = $10$

$$41 = (n-1)*10 + 1$$

$$n = 5$$
0 votes
0 votes
Answer:

Related questions