Trusted by +2 million users,
1000+ happy students everyday
Showing pages 1 to 1 of 2 pages
Prim’s Algorithm:This algorithm is used to find minimum cost spanning tree. This algorithm uses greedy approach.Prim’s algorithm treats each node in the given graph as single tree and search for less weightededge. Here are some steps that are followed using this algorithm,1.First all loops (self-loops) are removed and parallel edges.2.Choose an arbitrary node as root node randomly.3.Checking outgoing edges and select the one with less cost or less weight.4.And the process in the point 3 will be continued until we reach at the end of the givenundirected graph. Through this method we will get a spanning tree with the shortest part.Pros:This algorithm is faster than the Brute Force.Cons:This algorithm may not give optimal solution in comparison of Brute Force Algorithm.Brute Force AlgorithmHere are some steps,1.According to this algorithm we first list all possible Hamilton circuits ( means learningout the exact reversals, if you wish )2.Thencalculateweight of each circuits3.Choose the one with thesmallestweight.Pros:This algorithms always work if there is enough time and care.Easy to understand and implement.It can give an optimal (best) solution.
desklib-logo
You’re reading a preview
Preview Documents

To View Complete Document

Click the button to download
Subscribe to our plans

Download This Document