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:
- As T is a minimum spanning tree and we need to add a new edge to existing spanning tree.
- 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.
- All vertices need to traverse to confirm minimum spanning tree after adding new edge then time complexity is O(V).
Option (D) is correct.
Article Tags :
Recommended Articles