Question

How much work must Kruskals MST algorithm do before it starts choosing edges for its MST? Assume the undirected graph has n

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In Kruskal's algorithm, before selecting the edges for MST, we have to sort the edges in ascending order of weights and then we start selecting edge with minimum weighted edge among the remaining edge will be selected which does not form cycle.

Hence the preliminary work includes:-

1. Sort the edges in ascending order of weights which will take O(m log m).

2. Create a set for each vertex v in graph using MAKE_SET operation which will take O(n) time. This is done in order to check for cycle, if it can form while selecting an edge.

Hence time complexity to do preliminary work is O(n + m log m).

In Kruskal's algorithm, in best case sorting of edges can be done in O(m) time( using insertion sort) . Then in best case, every time the minimum spanning tree can grow as single connected component and hence combining the vertices will take O(n) time. So total complexity will be O(m+n).

In worst case, sorting will take O(m log m) time (using merge sort). Then combining the vertices using FIND and UNION method will take O(log n) time. Hence doing this while adding each edge will take O(m log n) time.

Hence in worst case, time complexity will be O(m log m) + O(m log n) = O(m log (mn))

Please comment for any clarification.

Add a comment
Know the answer?
Add Answer to:
How much work must Kruskal's MST algorithm do before it starts choosing edges for its MST? Assume the undirected graph has n vertices and m edges. Explain the necessary preliminary work and its b...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT