0
0
Data Structures Theoryknowledge~5 mins

Minimum spanning tree (Kruskal'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 Kruskal's algorithm?
Kruskal's algorithm builds the MST by sorting all edges by weight and adding the smallest edge to the tree if it doesn't create a cycle, repeating until all vertices are connected.
Click to reveal answer
intermediate
How does Kruskal's algorithm check for cycles when adding edges?
It uses a data structure called Union-Find (Disjoint Set) to efficiently check if two vertices belong to the same connected component, preventing cycles.
Click to reveal answer
beginner
Why does Kruskal's algorithm sort edges by weight first?
Sorting edges by weight ensures that the algorithm always picks the smallest available edge, which helps build the MST with the minimum total weight.
Click to reveal answer
intermediate
What is the time complexity of Kruskal's algorithm?
The time complexity is O(E log E), where E is the number of edges, mainly due to sorting the edges. Union-Find operations are almost constant time.
Click to reveal answer
What does Kruskal's algorithm use to avoid cycles when adding edges?
ADepth-first search
BStack
CBreadth-first search
DUnion-Find data structure
What is the first step in Kruskal's algorithm?
ACreate a cycle
BPick a random vertex
CSort all edges by weight
DRemove the heaviest edge
Which of the following best describes the output of Kruskal's algorithm?
AA tree connecting all vertices with minimum total edge weight
BA path visiting all vertices exactly once
CA graph with maximum number of edges
DA disconnected set of vertices
If adding an edge creates a cycle, what does Kruskal's algorithm do?
ASkips that edge
BAdds the edge anyway
CRemoves a vertex
DRestarts the algorithm
What type of algorithm is Kruskal's algorithm?
ADynamic programming
BGreedy algorithm
CDivide and conquer
DBacktracking
Explain how Kruskal's algorithm builds a minimum spanning tree step-by-step.
Think about sorting edges and avoiding cycles.
You got /4 concepts.
    Describe why the Union-Find data structure is important in Kruskal's algorithm.
    Consider how to know if two vertices are already connected.
    You got /3 concepts.