edited by
25,708 views
93 93 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$

8 Answers

Best answer
126 126 votes
Initially, $n_1*1+n_2*2+n_3*3=2(n_1+n_2+n_3-1)   \implies  n_3=n_1-2$

Now we have removed all $2$ degree nodes, so number of edges in final graph is $n_1+n_3-1.$

Put $n_3=n_1-2,$ we get

Number of edges $=2*n_1-3$
selected by
56 56 votes

From the above tree, we will get the tree below 

Now, check with the options we will get $(A)$ as the answer.

edited by
8 8 votes
Another method:

Sum of degrees: n1+2*n2+3*n3

now number of edges =  (n1+2*n2+3*n3)/2

now all 2 degree nodes were removed ... by doing this degrees of remaining vertices will not affect. as we are forming an edge between neighbouring vertices.

hence number of edges= (n1+2*n2+3*n3-2*n2)/2 =  (n1+3*n3)/2

now replace n3 = n1-2 (from first linked question)

=>(n1+3(n1-2)) / 2

=>2n1-3
3 3 votes
May be we can eliminate b, c ,d .

By applying procedure given in a question, there will not be any node with degree 2 left  i.e  $n_2$ , only option A doesn't have   $n_2$ .
0 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

 

0 0 votes
Here consider in Graph G1 which includes n1=3, n2=1, n3=1 which means number of vertices with one, two and three degrees are given as below. Now we are one node V with degree 2 and removing it so now we'll have n1=3, n2=0, n3=1.

Now calculate initial values from options by putting values of n1,n2 and n3 we get a: 3, b: 5, c: 0 and d: 2 and with final values of n1,n2 and n3 we get options as a: 3, b: 4, c: 1, d:1. So the option where n2's value is used is getting affected so option A is correct.
Answer:
Position:
Show:

Related questions

68 68 votes
8 answers 8 answers
29.5k
29.5k views
Ishrat Jahan asked Oct 29, 2014
29,525 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...
29 29 votes
5 answers 5 answers
11.9k
11.9k views
Ishrat Jahan asked Oct 28, 2014
11,882 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...
38 38 votes
4 answers 4 answers
19.1k
19.1k views
Ishrat Jahan asked Oct 29, 2014
19,071 views
How many distinct BSTs can be constructed with $3$ distinct keys?$4$$5$$6$$9$
78 78 votes
4 answers 4 answers
24.0k
24.0k views
Ishrat Jahan asked Oct 29, 2014
24,010 views
A Binary Search Tree (BST) stores values in the range $37$ to $573$. Consider the following sequence of keys.$81, 537, 102, 439, 285, 376, 305$$52, 97, 121, 195, 242, 381...