Complete the code to initialize the MST set in Prim's algorithm.
mstSet = [False] * [1]
We create a list of False values with length equal to the number of vertices in the graph to track which vertices are included in the MST.
Complete the code to find the vertex with the minimum key value not yet included in MST.
for v in range(V): if key[v] < min_key and mstSet[[1]] == False: min_key = key[v] min_index = v
We check if the vertex v is not yet included in MST by checking mstSet[v].
Fix the error in updating the key values for adjacent vertices in Prim's algorithm.
for v in range(V): if graph[u][v] and mstSet[v] == False and graph[u][v] < [1][v]: key[v] = graph[u][v] parent[v] = u
We compare the edge weight graph[u][v] with the current key value for vertex v to update it if smaller.
Fill both blanks to correctly initialize the key and parent arrays before starting Prim's algorithm.
key = [[1]] * V parent = [[2]] * V
We initialize key values to infinity to represent unknown minimum weights, and parent to -1 to indicate no parent assigned yet.
Fill all three blanks to complete the dictionary comprehension that builds the MST result with vertex and its parent.
mst_result = { [1]: [2] for [3] in range(1, V) }We iterate over vertices v from 1 to V-1, mapping each vertex v to its parent parent[v] in the MST result dictionary.
