Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Let G = (V, G) be a weighted undirected graph... Start Learning for Free
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∣)
Correct answer is option 'D'. Can you explain this answer?
Verified Answer
Let G = (V, G) be a weighted undirected graph and let T be a Minimum S...
  • 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.
View all questions of this test
Most Upvoted Answer
Let G = (V, G) be a weighted undirected graph and let T be a Minimum S...
  • 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.
Free Test
Community Answer
Let G = (V, G) be a weighted undirected graph and let T be a Minimum S...
Is added to G, where u and v are vertices in V. This new edge creates a cycle in the graph. To update the MST, we need to remove an edge from the cycle and add the new edge.

The key observation is that the edge to be removed from the cycle must be the heaviest edge in the cycle. This is because if we remove a lighter edge, the resulting graph will not be a spanning tree.

To find the heaviest edge in the cycle, we can use a depth-first search (DFS) starting from either u or v. During the DFS, we keep track of the maximum-weight edge encountered so far in the cycle.

Here is the algorithm to update the MST:

1. Perform a DFS starting from u or v to find the heaviest edge in the cycle. Let this edge be (x, y) with weight w.
2. Remove edge (x, y) from the MST.
3. Add edge (u, v) to the MST.
4. Return the updated MST.

The time complexity of this algorithm is O(V + E), where V is the number of vertices and E is the number of edges in the graph. This is because we perform a DFS, which takes O(V + E) time, and update the MST in constant time by removing and adding edges.

Note that this algorithm assumes that the weights of the edges in the graph are distinct. If there are multiple edges with the same weight, we need to modify the algorithm to handle this case.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer?
Question Description
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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about 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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for 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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer?.
Solutions for 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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of 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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of 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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer?, a detailed solution for 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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer? has been provided alongside types of 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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice 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 isa)θ(E + V)b)θ(E.V)c)θ(E log V)d)θ(V)Correct answer is option 'D'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev