retagged by
293 views
1 votes
1 votes

A ternary tree is a tree in which every internal node has exactly three children.


The number of leaves in a ternary tree with $’z’$ internal nodes is _______.

  1. $2$$\left ( z+1 \right )$$+ 3$
  2. $2z$
  3. $3z$
  4. $2z + 1$
retagged by

2 Answers

Best answer
1 votes
1 votes

Key Idea  - The degree of a node = the number children of that node . 

Total number of nodes = Internal Nodes + Leaves  = z + L.

Also , Total Number of nodes = Internal Node * deg of Internal Node + Leaves *deg of Leaves + 1 ( Root Node)

                                           =  z*3 + L*0 + 1.

On equating the two L = 2z + 1

selected by
1 votes
1 votes

Option D) is correct answer


Let total number of nodes= $N$

Number of internal nodes= $z$

Number of leaves= $L$

Given a ternary tree in which each internal node has exactly 3 nodes.

$N=3*z+1$ ......(i)

Also $N=z+L$ .......(ii)

On solving (i), (ii)

$L=2z+1$

 

Answer:

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2
0 votes
0 votes
1 answer
4
Bikram asked Feb 9, 2017
278 views
What feature of heaps allows them to be efficiently implemented using a partially filled array?Heaps are binary search trees.Heaps contain only integer data.Heaps are ful...