Minimum Spanning Trees (Prim's Algorithm) Flashcards

(4 cards)

1
Q

What is a Minimum Spanning Tree (MST)?

A

A subset of a graph’s edges that connects all vertices with no cycles and minimum total edge weight.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does Prim’s Algorithm work?

A

Starts from any node, grows the MST by adding the smallest edge connecting a visited and unvisited node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What data structure optimizes Prim’s Algorithm?

A

A priority queue (e.g. min-heap) to efficiently get the minimum-weight edge.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the time complexity of Prim’s Algorithm?

A

O((V + E) log V) with a min-heap and adjacency list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly