Open In App

GATE | GATE MOCK 2017 | Question 21

Like Article
Like
Save
Share
Report

Consider a directed graph with n vertices and m edges such that all edges have same edge weights. Find the complexity of the best known algorithm to compute the minimum spanning tree of the graph?

(A) O(m+n)
(B) O(m logn)
(C) O(mn)
(D) O(n logm)


Answer: (A)

Explanation: It’s a special case in which all edge weights are equal, so dfs would work and resultant depth first tree would be the spanning tree. So the answer would be O(m+n).


Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads