Open In App

GATE | GATE CS 2020 | Question 41

Let G = (V, G) be a weighted undirected graph and let T be a Minimum Spanning Tree (MST) of G maintained using adjacency lists. Suppose a new weighed 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
(A) Θ(∣E∣ + ∣V∣)
(B) Θ(∣E∣.∣V∣)
(C) Θ(E∣ log ∣V∣)
(D) Θ(∣V∣)

Answer: (D)
Explanation:

  1. As T is a minimum spanning tree and we need to add a new edge to existing spanning tree.
  2. Later we need to check still T is a minimum spanning tree or not, So we need to check all vertices whether there is any cycle present after adding a new edge.
  3. All vertices need to traverse to confirm minimum spanning tree after adding new edge then time complexity is O(V).

Option (D) is correct.


Quiz of this Question

Article Tags :