dsa9 min read
Prim's Algorithm — MST via Min-Heap Greedy Expansion [Google, Amazon, Microsoft]
Master Prim's algorithm for Minimum Spanning Tree: grow a single tree from any starting vertex by repeatedly attaching the cheapest crossing edge using a min-heap. The dense-graph counterpart to Kruskal, asked at Google, Amazon, and Microsoft.
Read →