Explanation

- **Kruskal’s Algorithm** is a greedy algorithm used to find the **minimum spanning tree (MST)** of a graph. It selects edges in increasing weight order, ensuring no cycles are formed, and the graph remains connected.

-

  • Steps:

    • Sort all the edges of the graph in non-decreasing order of their weight.
    • Initialize a disjoint-set (union-find) structure to keep track of cycles.
    • For each edge in the sorted list, if the edge connects two different sets, include it in the MST and merge the sets.
    • Repeat until the MST contains V-1 edges (where V is the number of vertices).
  • Time Complexity:

    • O(E log E), where E is the number of edges.