Recall & Review
beginner
What is a Minimum Spanning Tree (MST)?
A Minimum Spanning Tree is a subset of edges in a connected, weighted graph that connects all vertices together without any cycles and with the minimum possible total edge weight.
Click to reveal answer
beginner
What is the main idea behind Prim's Algorithm?
Prim's Algorithm builds the MST by starting from any vertex and repeatedly adding the smallest edge that connects a vertex in the MST to a vertex outside it, until all vertices are included.
Click to reveal answer
beginner
In Prim's Algorithm, how do we select the next edge to add?
We select the edge with the smallest weight that connects a vertex already in the MST to a vertex not yet in the MST.
Click to reveal answer
intermediate
What data structure is commonly used to efficiently select the next edge in Prim's Algorithm?
A priority queue (or min-heap) is used to quickly find and extract the edge with the smallest weight connecting to the MST.
Click to reveal answer
intermediate
What is the time complexity of Prim's Algorithm using a priority queue?
The time complexity is O(E log V), where E is the number of edges and V is the number of vertices, because each edge is processed and the priority queue operations take logarithmic time.
Click to reveal answer
What does Prim's Algorithm start with?
✗ Incorrect
Prim's Algorithm starts from any single vertex and grows the MST from there.
Which data structure helps Prim's Algorithm pick the smallest edge efficiently?
✗ Incorrect
A priority queue (min-heap) helps select the smallest edge quickly.
What condition must an edge satisfy to be added to the MST in Prim's Algorithm?
✗ Incorrect
Edges must connect the MST to a new vertex outside it.
What happens if the graph is not connected when running Prim's Algorithm?
✗ Incorrect
Prim's Algorithm only works on connected graphs; otherwise, some vertices remain unreachable.
What is the main goal of Prim's Algorithm?
✗ Incorrect
Prim's Algorithm finds the minimum spanning tree of a graph.
Explain step-by-step how Prim's Algorithm builds a Minimum Spanning Tree.
Think about growing the tree one edge at a time.
You got /4 concepts.
Describe why a priority queue is useful in Prim's Algorithm and how it affects performance.
Consider how to quickly find the next best edge.
You got /4 concepts.