Given below are the steps of Prim's algorithm. Sort them in the order that reconstructs the initial algorithm.
Computer scienceAlgorithms and Data StructuresAlgorithmsGraph algorithmsMinimum spanning tree algorithms
Prim's algorithm
Reconstructing the algorithm
Report a typo
Put the items in the correct order
Repeat two previous steps while there are edges that can be added to the current tree. Then, return the resulting tree as a final answer.
Select an arbitrary node in a graph as the first node of a spanning tree.
Consider all edges such that is a node of the current tree and is not.
Among all such edges, chose the one with the smallest weight and add it to the current tree.
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.