edited by
29,755 views
69 69 votes

A binary tree with $n > 1$ nodes has $n_1$, $n_2$ and $n_3$ nodes of degree one, two and three respec­tively. The degree of a node is defined as the number of its neighbours.

$n_3$ can be expressed as

  1. $n_1 + n_2 - 1$  
  2. $n_1 -2$
  3. $[((n_1 + n_2)/2)]$
  4. $n_2 - 1$

8 Answers

Best answer
127 127 votes

Given definition of degree: no of neighbours of a node.

total nodes $= n = n_1 + n_2 + n_3$

Apply handshaking lemma:

Sum of degrees $= 2 * $no of edges

$1 * n_1 + 2 * n_2 + 3 * n_3  =  2 (n-1)$

Total number of edges in graph will always be $(n_1+n_2+n_3-1)$.

$1 * n_1 + 2 * n_2 + 3 * n_3  =  2 (n_1+n_2+n_3-1)$

$n_1 + 2 n_2 + 3 n_3  =  2 n_1 + 2 n_2 + 2 n_3 - 2$

$n_3 = n_1 - 2$   Option B

edited by
29 29 votes

No. of node in binary with  1 degree i.e. leaf node

2 degree i.e. only root note

node with 3 degree i.e. internal node except root (degree 2)

so number of degree 3 vertices are calculated = interms of internal node -1

internal node = leaf node -1 i.e. n1-1

since from internal node root is 2 degree vertex so removes it 

So no. of 3 degree vertices are = n1-1-1= n1-2

8 8 votes

Option b is right.

 

1 1 vote

this question can be done without the help of number of edges . 

We know that :

number of internal nodes with 2 children (I) =  number of leaf nodes (L) - 1

n1 is node with degree 1 -- they are leaf nodes [h,e,f,g]

n2 is node with degree 2 -- they are nodes with 1 children and the root node [a ,d]

n3 is node with degree 3 -- they are internal nodes with two children but it does not include the root node because root node has degree 2 [b,c]

so , 

n3  = internal node - 1  {this 1 excludes the root node }

n3 = (leaf nodes - 1) - 1 

n3 = n1 - 2

hence option B is correct . 

 

 

0 0 votes
n1 = degree 1 node , n2 =degree 2 nodes , n3= degree 3 nodes
Here degree means no of neighbours

Now confusion is what to consider as neighbours ? Is no of neighbours  are no of childs or normal degree right ?
So if it no of childs we consider it means we have treated binary tree as directed so n3 = degree 3 nodes means we are considering
3 childs which is not possible in BT

So , here binary tree considered as Undirected tree
Now we can apply the normal procedure
Sum of degree = 2( no of edges )

Note : Here if root have only 1 child it means 1 degree right so it has been covered by n1 nodes or if root has 2 childs then it means 2 degree right so it has been covered by n2 nodes

So no need to worry about how to handle the root

Now use the formula
Edges = total nodes (Vertices ) -1
n1*1 + n2*2+ n3*3 = 2( n1+n2+n3 -1 )
n1 + 2n2 + 3n3 = 2n1+2n2+2n3-2

n3=n1-2

If in case any doubt regarding any Pyqs like this
Tag Me will help to solve it
Answer:
Position:
Show:

Related questions

95 95 votes
8 answers 8 answers
25.9k
25.9k views
Ishrat Jahan asked Oct 29, 2014
25,944 views
A binary tree with $n 1$ nodes has $n_1$, $n_2$ and $n_3$ nodes of degree one, two and three respec­tively. The degree of a node is defined as the number of its neighbou...
30 30 votes
5 answers 5 answers
11.9k
11.9k views
Ishrat Jahan asked Oct 28, 2014
11,915 views
The following three are known to be the preorder, inorder and postorder sequences of a binary tree. But it is not known which is which.$MBCAFHPYK$$KAMCBYPFH$$MABCKYFPH$Pi...
4 4 votes
3 answers 3 answers
5.0k
5.0k views
Ishrat Jahan asked Oct 27, 2014
4,968 views
Which of the following is TRUE only of XML but NOT HTML?It is derived from SGMLIt describes content and layoutIt allows user defined tagsIt is restricted only to be used ...
39 39 votes
4 answers 4 answers
19.2k
19.2k views
Ishrat Jahan asked Oct 29, 2014
19,158 views
How many distinct BSTs can be constructed with $3$ distinct keys?$4$$5$$6$$9$