• edited by
21,050 views
62 62 votes

An undirected graph $G(V,E)$ contains $n \: (n>2)$ nodes named $v_1,v_2, \dots, v_n$. Two nodes $v_i, v_j$  are connected if and only if $ 0 < \mid i-j\mid \leq 2$. Each edge $(v_i,v_j)$ is assigned a weight $i+j$. A sample graph with $n=4$ is shown below.

The length of the path from $v_5$ to $v_6$ in the MST of previous question with $n=10$ is

  1. $11$
  2. $25$
  3. $31$
  4. $41$

7 Answers

Best answer
119 119 votes

 

Above is the graph.
Below is the MST.

Length of the path from $v_5$ to $v_6= 8+4+3+6+10= 31$ (Answer)

Correct Answer: $C$

• edited by
36 36 votes

There is no direct edge between Vi and Vi+1 vertex in mst except V1 to V2 so path from Vi and Vi+1 includes all edges from v1 to Vi+1 which are in mst:

edge weights in mst:

=3 + 4 + 6 + 8 + 10 + 12 +...+*(2(n-1))

=1+(2+ 4+6+....till n-1 terms)

=1+ 2(1+2+3+4+...n-1) 

=1+(n-1)*n=n2-n+1

In this case v6 = 62-6+1 =31

• edited by
5 5 votes

Answer is C.

It can be easily obtained by drawing graph for up to 7 vertices.

3 3 votes

From the previous question, we know $n^2-n+1$ will be the weight of the MST with $n>2$

Evidently, only $V_1$ and $V_2$ are connected, and no other vertex $V_i$ is connected to $V_{i+1}$

 

We can wisely use the above equation. For a path between $V_5$ and $V_6$, vertices more than 6 are redundant, since weight only increases for a larger $i$ of any vertex $V_i$ here.

We only need an MST upto 6 vertices. Path from $V_5$ to $V_6$ ill be included in it. It's weight will be $n^2-n+1$

=> $36-6+1$

=> $31$

 

1 1 vote

In this question, sum of weights of mst for distinct values of n is following a pattern.

Ex. For n= 4, we have,

Sum of weight of mst = 3(v1->V2) + 4(v1->v3)+ 6 (v2->v4) 

For n =5 , we have,

Sum of weights of mst = same as weight of mst for n=4 + 8(v3->v5)

We are observing two patterns here: 

1) first is the weight of mst for n nodes is given by ----- weight of mst with n-1 nodes + (maximum weight of edge in mst having n-1 nodes + 2).

2) and the second pattern is in the edges we are taking.  Like in n=4, the last edge we have taken is (v2->v4) , then in n=5, the last edge taken is from (v3->v5) and the rest edges are same as that of n=4, similarly for n=6, the edge taken would be from v4->V6, for n=7 , it would be from v5-> v7...and so on.

Now for n=10, we have to find weight of path form v5to V6.

The pattern for the mst would be :- 

3(v1->V2) + 4(v1->v3) + 6(v2->v4) + 8(v3->v5) + 10(v4->V6) +12(v5->v7).......so on.

Sum of path from v5- to V6 in mst = 8(v5->v3) +4(v3->v1) + 3(v1->V2) + 6(v2->v4) + 10(v4->V6) = 31 .

so, 31 is the answer.

0 0 votes

For easy visualisation, try to imagine all the vertices in horizontal line

The value 5+6=11 seems legit, however it will not give MST as,

it would be much better to connect 6 with 4 as we can get 6+4 = 10.

Basically MST can be obtained if we connect alternate edges,

with only exception of vertices 1 and 2.

 

3 + 4 + 6 + 8 + 10 = 31

 

Q1. Why this technique will give MST ?

Q2. Why only 1 and 2 should be joined horizontally ?

 

A1. we only have two ways to join two vertices either consecutively or alternate.

we just saw how continous joining was inefficient as compared to alternate.

 

A2. When we make these types of alternate pairing we will be left with two sets of even and odd numbers

in order to join these two sets we select the minimum from both of them

here,  1 is from the odd set

   and 2 is from even set.

 

 

Answer:
Position:
Show:

Related questions

77 77 votes
11 answers 11 answers
27.5k
27.5k views
go_editor asked Sep 29, 2014
27,543 views
An undirected graph $G(V,E)$ contains $n \: (n>2)$ nodes named $v_1,v_2, \dots, v_n$. Two nodes $v_i, v_j$ are connected if and only if $ 0 < \mid i-j\mid \leq 2$. Each ...
78 78 votes
4 answers 4 answers
24.8k
24.8k views
go_editor asked Sep 29, 2014
24,790 views
On a non-pipelined sequential processor, a program segment, which is the part of the interrupt service routine, is given to transfer $500$ bytes from an I/O device to mem...
15 15 votes
3 answers 3 answers
5.2k
5.2k views
Misbah Ghaya asked Oct 24, 2015
5,215 views
Let $G$ be a connected simple graph (no self-loops or parallel edges) on $n\geq 3$ vertices, with distinct edge weights. Let $e_{1}, e_{2},...,e_{m}$ be an ordering of th...
30 30 votes
2 answers 2 answers
9.3k
9.3k views
go_editor asked Apr 21, 2016
9,329 views
Consider the following recursive C function that takes two arguments.unsigned int foo(unsigned int n, unsigned int r) { if (n>0) return ((n%r) + foo(n/r, r)); else return...