Prims Algorithm

Like Kruskal’s algorithm, Prim’s algorithm is used for finding minimum spanning tree. The idea is to maintain two sets of vertices. The first set contains the vertices already included in the MST, the other set contains the vertices not yet included. At every step, it considers all the edges that connect the two sets, and ...