🎉 October Learning Month — learn a new software term every day!
An interactive flashcard trainer for software engineering terms.

Prim

In plain terms

Grows a minimum spanning tree outward from a starting node.

Going deeper

Prim's algorithm starts at one node and repeatedly adds the cheapest edge connecting the tree to a new node. It builds the MST incrementally.

Under the hood

O(E log V) with a heap; better than Kruskal on dense graphs since it grows one connected component.

Examples

Minimum spanning trees, network/utility design, dense-graph MSTs.

Think of it like...

Like expanding a power grid one cheapest new connection at a time from a central plant.

Feedback & Bug Report