• edited by
39,473 views
77 77 votes

In a binary tree, the number of internal nodes of degree $1$ is $5$, and the number of internal nodes of degree $2$ is $10$. The number of leaf nodes in the binary tree is

  1. $10$
  2. $11$
  3. $12$
  4. $15$

14 Answers

Best answer
144 144 votes

A node in a binary tree has degree $0, 1$ or $2$. 

Ref: http://faculty.cs.niu.edu/~mcmahon/CS241/Notes/bintree.html

We are given no. of $1$ degree node $= 5$, no. of $2$ degree nodes $= 10$. 

Total no. of edges $= 1*5 + 2*10 = 25$ (In tree degree is for outgoing edges only, and hence each degree corresponds to an edge)

So, total no. of nodes $= 25 + 1 = 26$ (No. of nodes in a tree is $1$ more than no. of edges).

Now, no. of leaf  nodes (nodes with $0$ degree) $= 26 - 5 - 10 = 11$.

Correct Answer: $B$

• edited by
88 88 votes
In a binary Tree,

no of nodes of degree 2 = no of leaves - 1.

No of nodes of degree 1 do not affect no of leaves !

No of leafs = No of nodes of degree 2 + 1 = 10 + 1 = 11
7 7 votes
In a directed graph indegree of a graph = outdegree

Outdegree = 1*5 + 2*10

Let number of leaves be x

Indegree = x*1 + 14 *1 (all nodes except root have indegree = 1)

Outdegree = indegree

x = 11
0 0 votes

Given n1=5, n2= 10, n0=?

Total nodes N= n0+n1+n2

N=n0+15 = Edges -1

Edges= n0*0+n1*1+n2*2

N-1= n1+2n2

15+n0-1= n1+2n2

On solving we get n0= 11

Hence Option B) is correct answer

0 0 votes

 

@Shaik Masthan @Arjun Sir can we apply here 

x*1 + 5 *2 + 10*3  -1 = 2* (x+5+10 - 1)     (considering degree as no of incident edges , sum of degree=2 |E| )

x= 39-28  = 11  (ans)                             x is no of leaf nodes.. 1 subtracted as root have only 2 incident edges

It's giving right answer

but is it conceptually correct??

• edited by
Answer:
Position:
Show:

Related questions

58 58 votes
3 answers 3 answers
17.1k
17.1k views
Ishrat Jahan asked Nov 1, 2014
17,094 views
An array $X$ of n distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. If the root node is at level $0$, the le...
64 64 votes
6 answers 6 answers
21.8k
21.8k views
Ishrat Jahan asked Nov 1, 2014
21,849 views
An array $X$ of $n$ distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. The index of the parent of element $X[...
38 38 votes
6 answers 6 answers
26.7k
26.7k views
Ishrat Jahan asked Oct 31, 2014
26,724 views
Suppose that we have numbers between $1$ and $100$ in a binary search tree and want to search for the number $55$. Which of the following sequences CANNOT be the sequence...
36 36 votes
6 answers 6 answers
18.0k
18.0k views
Ishrat Jahan asked Oct 31, 2014
18,001 views
Which of the following statement(s) is TRUE?A hash function takes a message of arbitrary length and generates a fixed length code.A hash function takes a message of fixed...