Answer: VMWARE MTS OA (2023) | Graph Connectivity Optimization Using Greedy Algorithms a
Answer · Posted Jun 2026
Approach A Minimum Spanning Tree is a subset of edges that: Connects all vertices. Contains no cycles. Has minimum total weight. We use Kruskal's Algorithm, which follows a greedy strategy. Strategy Step 1 Sort all edges in ascending order of weight. Step 2 Initialize a Disjoint Set Union (DSU) structure. Initially: Each node belongs to its own component. Step 3 Process edges from smallest weight to largest. For every edge: (u, v, w) Check if u and v belong ...
The full answer & interview discussion are available to premium members.
Log in Create a free account