0
0
Data Structures Theoryknowledge~5 mins

Minimum spanning tree (Prim's) in Data Structures Theory - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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 tree to a vertex outside the tree until all vertices are included.
Click to reveal answer
beginner
How does Prim's algorithm choose the next edge to add?
It selects the edge with the smallest weight that connects a vertex already in the MST to a vertex not yet included.
Click to reveal answer
intermediate
Why does Prim's algorithm always produce a minimum spanning tree?
Because it always picks the smallest possible edge that expands the tree without creating cycles, ensuring the total weight is minimized.
Click to reveal answer
intermediate
What data structure is commonly used to efficiently implement Prim's algorithm?
A priority queue (or min-heap) is used to quickly select the edge with the smallest weight at each step.
Click to reveal answer
What does Prim's algorithm start with?
AAn empty graph
BAll edges
CThe heaviest edge
DAny single vertex
Which of the following best describes the edge selection in Prim's algorithm?
ASmallest edge connecting the MST to a new vertex
BRandom edge from the graph
CLargest edge in the graph
DEdges that form cycles
What type of graph is required for Prim's algorithm to work correctly?
ADisconnected graph
BDirected graph
CConnected weighted graph
DGraph with no edges
What is the main goal of Prim's algorithm?
AFind the shortest path between two vertices
BFind a minimum spanning tree
CFind a cycle in the graph
DSort all edges by weight
Which data structure helps Prim's algorithm efficiently pick the next edge?
APriority queue (min-heap)
BQueue
CStack
DLinked list
Explain how Prim's algorithm builds a minimum spanning tree step-by-step.
Think about growing the tree one edge at a time.
You got /4 concepts.
    Why is a priority queue useful in Prim's algorithm?
    Consider how to find the minimum edge fast.
    You got /3 concepts.