GateAI
Minimum Spanning Trees

GATE CSE 2020 · Q31

MCQ2 marksMedium

Time

Let G=(V,E)G = (V,E) be a weighted undirected graph and let TT be a Minimum Spanning Tree (MST) of GG maintained using adjacency lists. Suppose a new weighted edge (u,v)∈V×V(u, v) \in V \times V is added to GG. The worst case time complexity of determining if TT is still an MST of the resultant graph is

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: D) (|V|)

Minimum Spanning Trees

When a new edge e=(u,v)e = (u, v) with weight w(u,v)w(u, v) is added to the graph GG, TT remains a spanning tree for G∪{e}G \cup \{e\}.

By the Cycle Property of MSTs:

  • Adding (u,v)(u, v) to the tree TT introduces exactly one simple cycle, which consists of the new edge (u,v)(u, v) and the unique simple path between uu and vv in TT.

  • TT remains an MST of G∪{e}G \cup \{e\} if and only if the newly added edge (u,v)(u, v) is the maximum weight edge (or tied for maximum weight) on this cycle. That is, w(u,v)≥w(e′)w(u, v) \ge w(e^{\prime}) for all edges e′e^{\prime} on the path between uu and vv in TT.

Since TT is a tree with ∣V∣|V| vertices and ∣V∣−1|V|-1 edges:

  • Finding the unique path between uu and vv in TT and identifying the maximum weight edge on it can be done via standard graph traversal (DFS or BFS) on TT.

  • DFS or BFS on a tree with ∣V∣|V| vertices takes time O(∣V∣+(∣V∣−1))=Θ(∣V∣)O(|V| + (|V|-1)) = \Theta(|V|).

Thus, the worst-case time complexity is Θ(∣V∣)\Theta(|V|), which corresponds to option D.

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 Q31 of the GATE CSE 2020 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 2020 has 2.

How GATE tests Minimum Spanning Trees

More from GATE CSE 2020

Share this solution

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

GateAI solution cardGATE CSE 2020 · Q31 · MCQ

Let G = (V,E) be a weighted undirected graph and let T be a Minimum Spanning Tree (MST) of G maintained using adjacency lists. Suppose a new weighted edge (u, v) ∈ V × V is added to G. The worst case time complexity of determining if T is still an MST of the resultant graph is

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.