646 views
0 votes
0 votes
Let A be ternary tree with each node having 0 or 3 children . Let T have 25 node .The number of leaf nodes in ternary tree are

2 Answers

Best answer
2 votes
2 votes
Let n-ary tree has X nodes, then
X = Internal nodes + Leaf nodes      ...................(1)

Also, Leaf nodes = Internal nodes ( n - 1 ) + 1     ..................(2)

So, given X = 25 , 3-ary tree
Leaf nodes = Internal nodes ( 3 - 1) + 1     ...............( using (2) )

=> Leaf nodes = 2 Internal nodes + 1

Putting in eq. (1)

X = Internal nodes + 2 Internal nodes + 1

25 = 3 Internal nodes + 1

=> Internal nodes = 8

=> Leaf nodes = 25 - 8 = 17
selected by

Related questions

0 votes
0 votes
0 answers
1
raja11sep asked Dec 31, 2021
384 views
Anyone please explain this .
0 votes
0 votes
0 answers
2
singh chetan asked Jan 22, 2019
859 views
HOW TO SOLVE ?PLEASE PROVIDE THE COMPLETE SOLUTION.
1 votes
1 votes
0 answers
3
Raja Rawal asked Jan 14, 2019
909 views
how to solve (the logic behind this question)