edited by
36,460 views
62 62 votes

Consider a complete undirected graph with vertex set $\{0, 1, 2, 3, 4\}$. Entry $W_{ij}$ in the matrix $W$ below is the weight of the edge $\{i, j\}$

$$W=\begin{pmatrix} 0 & 1 & 8 & 1 & 4 \\ 1 & 0 & 12 & 4 & 9 \\ 8 & 12 & 0 & 7 & 3 \\ 1 & 4 & 7 & 0 & 2 \\ 4 & 9 & 3 & 2 & 0 \end{pmatrix}$$

What is the minimum possible weight of a spanning tree $T$ in this graph such that vertex $0$ is a leaf node in the tree $T$?

  1. $7$
  2. $8$
  3. $9$
  4. $10$

12 Answers

Best answer
56 56 votes

Answer is (D) $10$. The edges of the spanning tree are: $0 - 1, 1 - 3, 3 - 4, 4 - 2$. Total Weight $= 10$
 

edited by
44 44 votes

To get Minimum Spanning Tree with 0 as leaf node, we must first remove node 0 from the graph. Then we must find MST for the remaining graph and then join 0 to the obtained MST with minimum weight edge. Well this was somewhat obvious.

But how to solve it in most efficient way? We should not draw the graph and then look for MST, it will take lot of time. Instead we should make use of the given weight matrix to find the MST, as shown below:

 As node 0 is removed, we won't consider 0th row and 0th column.

Now, list down edges in increasing order of their weight:

(3-4) => 2, (2-4) => 3, (1-3) => 4, (2,3) => 7 and so on..

To get MST, we must form edges in the above increasing order such that there is no cycle until all vertices are covered.

 Joining node 0 to the MST with minimum edge weight.

So minimum possible weight = 2+3+4+1 = 10

 

12 12 votes
For finding minimum spanning tree with vertex 0 as a leaf node,first of all remove 0th row and 0th column and then get the MST of remaining graph and then connect the vertex 0 with the edge with minimum weight(we have two options as there are two 1s in 0th row).

So Answer is (d) i.e. 10
8 8 votes

 

 vertex 0 is a leaf node in the tree T.

This line means , ki 0th vertex hamesa as a leaf node hi hogi.

or agr vo leaf node to uska sirf 1 hi parent hoga.

 

to iska matab ye ki hame 0th vertex ko sirf 1 edge se hi jodna he.

to is vajy se hamara answer 10 aa rha he .

 

or agr vahi ye tree ki jagh graph hota to hamara answer aata 7.

4 4 votes

$V_0$ is supposed to be the leaf.

In a tree, a leaf has degree 1. Hence, we can choose exactly one edge for $V_0$

Obviously, we'll choose any of the two edges with weight 1. (Blue colour — select either one.)

Then, apply Kruskal; we'd choose only minimum weight edges, ie, 2, 3 and 4. (Red colour)

Weight = $1+2+3+4=10$

1 1 vote

One possible traversal be like this also-

2--->4--->3--->1--->0 having weights 3, 2, 4, 1 respectively and 0 is at last position means 'at leaf' as mentioned in the question.

So, total weight is 3+2+4+1 = 10 answer.

Answer:
Position:
Show:

Related questions

48 48 votes
5 answers 5 answers
24.2k
24.2k views
go_editor asked Apr 21, 2016
24,193 views
Consider a complete undirected graph with vertex set $\{0, 1, 2, 3, 4\}$. Entry $W_{ij}$ in the matrix $W$ below is the weight of the edge $\{i, j\}$$$W=\begin{pmatrix} 0...
43 43 votes
5 answers 5 answers
17.1k
17.1k views
go_editor asked Sep 30, 2014
17,054 views
What is the value printed by the following C program?#include<stdio.h int f(int *a, int n) { if (n <= 0) return 0; else if (*a % 2 == 0) return *a+f(a+1, n-1); else retur...
91 91 votes
4 answers 4 answers
26.9k
26.9k views
go_editor asked Sep 29, 2014
26,930 views
The weight of a sequence $a_0,a_1, \dots, a_{n-1}$ of real numbers is defined as $a_0+a_1/2+ \dots + a_{n-1}/2^{n-1}$. A subsequence of a sequence is obtained by deleting...
96 96 votes
10 answers 10 answers
40.2k
40.2k views
go_editor asked Apr 21, 2016
40,161 views
A computer system has an $L1$ cache, an $L2$ cache, and a main memory unit connected as shown below. The block size in $L1$ cache is $4$ words. The block size in $L2$ cac...