GateAI
Minimum Spanning Trees

GATE CSE 2011 · Q54

MCQ2 marksMedium

Time

Statement for Linked Answer Questions 54 and 55

An undirected graph G(V,E)G(V, E) contains nn (n>2n > 2) nodes named v1,v2,…,vnv_1, v_2, \ldots, v_n. Two nodes vi,vjv_i, v_j are connected if and only if 0<∣i−j∣≤20 < |i - j| \le 2. Each edge (vi,vj)(v_i, v_j) is assigned a weight i+ji + j. A sample graph with n=4n = 4 is shown below. What will be the cost of the minimum spanning tree (MST) of such a graph with nn nodes?

GATE CSE 2011 Q54 diagram

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) n2 - n + 1

Minimum Spanning Trees

Let us examine the edges and their weights:

  • Edges of the form (vi,vi+1)(v_i, v_{i+1}) for 1≤i≤n−11 \le i \le n-1 with weight i+(i+1)=2i+1i + (i+1) = 2i + 1.

  • Edges of the form (vi,vi+2)(v_i, v_{i+2}) for 1≤i≤n−21 \le i \le n-2 with weight i+(i+2)=2i+2i + (i+2) = 2i + 2.

Let us test for small values of nn using Kruskal's algorithm:

For n=3n = 3:

  • Vertices: v1,v2,v3v_1, v_2, v_3

  • Edges sorted by weight:

    1. (v1,v2)(v_1, v_2), weight =3= 3

    2. (v1,v3)(v_1, v_3), weight =4= 4

    3. (v2,v3)(v_2, v_3), weight =5= 5

  • MST selects (v1,v2)(v_1, v_2) [weight 3] and (v1,v3)(v_1, v_3) [weight 4].

  • Total MST cost =3+4=7= 3 + 4 = 7.

For n=4n = 4:

  • Edges sorted by weight:

    1. (v1,v2)(v_1, v_2), weight =3= 3

    2. (v1,v3)(v_1, v_3), weight =4= 4

    3. (v2,v3)(v_2, v_3), weight =5= 5

    4. (v2,v4)(v_2, v_4), weight =6= 6

    5. (v3,v4)(v_3, v_4), weight =7= 7

  • MST selects:

    • (v1,v2)(v_1, v_2) (3)

    • (v1,v3)(v_1, v_3) (4)

    • (v2,v4)(v_2, v_4) (6)

  • Total MST cost =3+4+6=13= 3 + 4 + 6 = 13.

Now, test the options for n=3n = 3 and n=4n = 4:

  • Option (A): 112(11n2−5n)\frac{1}{12}(11n^2 - 5n)

    • For n=3n = 3: 112(99−15)=7\frac{1}{12}(99 - 15) = 7

    • For n=4n = 4: 112(176−20)=13\frac{1}{12}(176 - 20) = 13

    • Wait, let us check for n=5n = 5:

      • For n=5n = 5, edges in MST:

        • (v1,v2)(v_1, v_2) (3)

        • (v1,v3)(v_1, v_3) (4)

        • (v2,v4)(v_2, v_4) (6)

        • (v3,v5)(v_3, v_5) (8)

        • Total cost =3+4+6+8=21= 3 + 4 + 6 + 8 = 21

      • Option A: 112(11(25)−25)=25012≠21\frac{1}{12}(11(25) - 25) = \frac{250}{12} \neq 21

      • Option B: n2−n+1n^2 - n + 1:

        • For n=3n = 3: 32−3+1=73^2 - 3 + 1 = 7

        • For n=4n = 4: 42−4+1=134^2 - 4 + 1 = 13

        • For n=5n = 5: 52−5+1=215^2 - 5 + 1 = 21

In general, the MST consists of:

  • The edge (v1,v2)(v_1, v_2) with weight 33.

  • The edges (vi,vi+2)(v_i, v_{i+2}) for 1≤i≤n−21 \le i \le n-2 with weights 2i+22i + 2.

Total weight of MST:

MST cost=3+∑i=1n−2(2i+2)=3+2(n−2)(n−1)2+2(n−2)=3+(n−2)(n−1)+2(n−2)\text{MST cost} = 3 + \sum_{i=1}^{n-2} (2i + 2) = 3 + 2\frac{(n-2)(n-1)}{2} + 2(n-2) = 3 + (n-2)(n-1) + 2(n-2)
=3+(n−2)(n+1)=3+n2−n−2=n2−n+1= 3 + (n-2)(n + 1) = 3 + n^2 - n - 2 = n^2 - n + 1

Thus, option B is the correct choice.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Minimum Spanning Trees previous year question is Q54 of the GATE CSE 2011 paper. Find more GATE CSE PYQs on Minimum Spanning Trees in Algorithms, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Minimum Spanning Trees PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Minimum Spanning Trees in GATE CSE

Minimum Spanning Trees has 13 GATE CSE PYQs across 9 papers from 2011 to 2026. 5 of them are 2-mark MCQs like this one, and GATE CSE 2011 has 2.

How GATE tests Minimum Spanning Trees

More from GATE CSE 2011

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2011 · Q54 · MCQ

Statement for Linked Answer Questions 54 and 55: An undirected graph G(V, E) contains n (n > 2) nodes named v1, v2, , vn. Two nodes vi, vj are connected if and only if 0 < |i - j| ≤ 2. Each edge (vi, vj) is assigned a weight i + j. A sample graph with n = 4 is shown below. What will be the cost of the minimum spanning tree (MST) of such a graph with n nodes?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.