GATE | GATE-CS-2003 | Question 90

What is the weight of a minimum spanning tree of the following graph ?

GATECS2003Q68
(A) 29
(B) 31
(C) 38
(D) 41


Answer: (B)

Explanation: (a,c), (a,d), (d,b), (b,g), (g,h), (h,f), (h,i), (i,j), (i,e) = 31
 

Background required – Minimum Spanning Tree (Prims / Kruskal)



In these type of questions, always go for kruskal’s algorithm to find out the the minimum spanning tree as it is easy and there are less chances of doing silly mistakes.

Algorithm:

Always pick the minimum edge weight and try to add to current forest (Collection of Trees) if no cycle is formed else discard.
As soon as u have added n-1 edges to the forest, stop and you have got your minimum spanning tree.

See the below image for construction of MST of this question.

graph

Weight of minimum spanning tree = Sum of all the edges in Minimum Spanning tree
= 31

This explanation has been provided by Pranjul Ahuja.

Visit the following links to learn more:
http://www.ics.uci.edu/~eppstein/161/960206.html
https://en.wikipedia.org/wiki/Minimum_spanning_tree


Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.