Skip to content
Official PYQ · 1991

GATE CS 1991 Q03 — Minimum Spanning Trees

Explain with AI

Kruskal’s algorithm for finding a minimum spanning tree of a weighted graph GG with nn vertices and mm edges has the time complexity of:

Select all correct options
View worked solution

Answer: B;D;E

The standard time complexity of Kruskal’s algorithm for a graph with nn vertices and mm edges is dominated by the step of sorting the edges:

  • Sorting mm edges takes O(mlog⁡m)O(m \log m) time.
  • Since m≤n2m \le n^2, we have log⁡m≤2log⁡n\log m \le 2 \log n, which means O(mlog⁡m)=O(mlog⁡n)O(m \log m) = O(m \log n).
  • The disjoint-set operations (using union by rank and path compression) take O(mα(n))O(m \alpha(n)) time, which is strictly dominated by the sorting step.

Thus, the tightest upper bound for Kruskal's algorithm is O(mlog⁡n)O(m \log n) (Option D).

By the definition of Big-O notation (f(x)=O(g(x))f(x) = O(g(x)) represents an asymptotic upper bound):

  1. Option D (O(mlog⁡n)O(m \log n)): This is the standard tight upper bound.
  2. Option B (O(mn)O(mn)): Since log⁡n≤n\log n \le n for all n≥1n \ge 1, we have mlog⁡n=O(mn)m \log n = O(mn). Therefore, O(mn)O(mn) is also a valid upper bound.
  3. Option E (O(m2)O(m^2)): For any connected graph, m≥n−1m \ge n - 1, which implies log⁡n=O(m)\log n = O(m). Thus, mlog⁡n=O(m2)m \log n = O(m^2), making O(m2)O(m^2) a valid upper bound as well.

Hence, options B, D, and E are all mathematically correct upper bounds.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Minimum Spanning Trees questions