Invent Another Algorithm

Did so well inventing Kruskal's algorithm, let's see if you devise Prim's.

Hint: You must add the next edge spreading out from the source node.

With the right implementation, Prim's algorithm is faster than Kruskal for dense graphs and very sparse graphs.


next up previous
Next: Idea Up: PRIM'S ALGORITHM Previous: PRIM'S ALGORITHM