Kruskal’s Algorithm Assignment Help

The Kruskal Algorithm begins having a forest that includes n trees. Each tree consists only by one node as well as nothing otherwise. In most action from the algorithm, two different trees of this forest tend to be connected to a bigger tree. Consequently, we keep having les less as well as larger trees in our forest until we end up in a tree that is the actual minimum genetic tree.

In each step we choose the side using the least cost. When the selected side connects nodes which belong in the same tree the side is rejected, and never analyzed again since it might produce a circle that will destroy the tree. Either this side or even the next one so as associated with minimum cost may connect nodes associated with different trees, and this we insert connecting two small trees into a bigger one.

Pseudocode For The Kruskal Algorithm.

  • E(1) : is the set of the sides of the minimum genetic tree.
  • E(2) : is the set of the remaining sides.

Kruskal Algorithm STEPS

    E(1) = 0,  E(2) = E 
    While E(1) contains less then n-1 sides and E(2) = 0 do
    From the sides of E(2) choose one with minimum cost - e(ij) 
    E(2) = E(2) -  e(ij)  
    If V(i), V(j) do not belong in the same tree then
    Unite the trees of V(i) and V(j) to one tree. 
    end (If) 
    end (While) 
    End of algorithm.