Q. What is the time complexity of Kruskal’s algorithm?

  • (A) o(log v)
  • (B) o(e log v)
  • (C) o(e2)
  • (D) o(v log e)
πŸ’¬ Discuss
βœ… Correct Answer: (B) o(e log v)
Explanation: kruskal’s algorithm involves sorting of the edges, which takes o(e loge) time, where e is a number of edges in graph and v is the number of vertices. after sorting, all edges are iterated and union-find algorithm is applied. union-find algorithm requires o(logv) time. so, overall kruskal’s algorithm requires o(e log v) time.

Explanation by: Mr. Dubey
kruskal’s algorithm involves sorting of the edges, which takes o(e loge) time, where e is a number of edges in graph and v is the number of vertices. after sorting, all edges are iterated and union-find algorithm is applied. union-find algorithm requires o(logv) time. so, overall kruskal’s algorithm requires o(e log v) time.

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
962
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
98%
Success Rate