Skip to content

Glossary: Algorithms Beyond the Basics in C++

Prim's algorithm

Also written: Prim

A way to build a minimum spanning tree by starting from one place and repeatedly adding the cheapest edge that reaches a new place, using a heap to find that edge. It produces the same total weight as Kruskal's algorithm.

Where the book teaches it

Related terms

Kruskal's algorithmminimum spanning tree