Prim's algorithm
mediumGrow a single tree by absorbing the cheapest edge leaving it. The only difference from Dijkstra is the priority: distance from the tree, not distance from the source.
Worst
O(E log V)Space O(V)Loading the prim's algorithm engine…