edited by
14,777 views
61 votes
61 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.

Starting with the above tree, while there remains a node $v$ of degree two in the tree, add an edge between the two neighbours of $v$ and then remove $v$ from the tree. How many edges will remain at the end of the process?

  1. $2 * n_1- 3$
  2. $n_2 + 2 * n_1 - 2$
  3. $n_3 - n_2$
  4. $n_2+ n_1- 2$
edited by

5 Answers

0 votes
0 votes

Taking a simpler approach.

as we know, n1 = number of leaves = n3 + root + 1 = n3 + 1 

=> n1 = n3 + 2

 

Now 

e = n - 1

   = n1 + n2 + n3 – 1.

after the process, each of two edges adjacent to a degree 2 node will be replaced by 1. For one node, 1 edge decreases. for n2 nodes, n2 edges decreases.

Therefore, new number of edges = e’ = e – n2

= n1 + n2 + n3 – 1 – n2

= n1 + n3 – 1

= n1 + n1 – 2 – 1

= 2*n1 –  3

Option A

 

Answer:

Related questions

42 votes
42 votes
5 answers
1
Ishrat Jahan asked Oct 29, 2014
16,943 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 neighbo...
32 votes
32 votes
2 answers
3
Ishrat Jahan asked Oct 29, 2014
12,568 views
How many distinct BSTs can be constructed with $3$ distinct keys?$4$$5$$6$$9$