Graph Algorithms

Answer & solution
Official answer: D
Worked explanation
Let e be the new edge and P the unique u-v path in T. If w(e)<max weight on P, replace a maximum-weight path edge by e; the resulting spanning tree is strictly lighter, so T fails. Conversely, if w(e)≥that maximum, consider any competing tree using e. Removing e separates it into two parts; P crosses that cut at some tree edge f with w(f)≤w(e). Replacing e by f gives an old-graph spanning tree no heavier than the competitor. Since T was minimum among old trees, no new competitor is lighter. A DFS of T visits at most |V|−1 edges, carrying the path maximum. No need to rerun an MST algorithm on all of G.
Derivation and answer
Adding edge(u, v) creates one cycle with the unique u-v path in T. T remains minimum exactly when the new weight is at least the maximum weight on that tree path. A DFS of the adjacency-list tree finds the path and its maximum in O(|V|), and an unpreprocessed path-like tree can force inspection ofΘ(|V|) edges. ThusΘ(|V|), D.