retagged by
350 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

272
views
1 answers
0 votes
Bikram asked Feb 9, 2017
272 views
A complete binary tree can be stored in an array.If index starts at $1$, to access the child of $i^{th}$ node, the _____$^{th}$ and _____ $^{th}$ index of array needs t...
247
views
1 answers
0 votes
Bikram asked Feb 9, 2017
247 views
A binary max-heap is implemented using an array $A$. The contents of $A$ is $\left \{90, 70, 75, 15, 45, 40, 60 \right \}$. The contents of $A\left[3 \right ]$ are increa...
294
views
1 answers
0 votes
Bikram asked Feb 9, 2017
294 views
A linked list stores the numbers in sorted order.What will be the contents of a list after the following insert & delete operations are performed? insert(4) insert(2) ins...
310
views
1 answers
0 votes
Bikram asked Feb 9, 2017
310 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...