Question
Which data structure is used in Prim’s Algorithm to
efficiently find the minimum edge connecting a vertex to the spanning tree?Solution
In Prim’s Algorithm, a Min-Heap (Priority Queue) is used to efficiently find and extract the minimum-weight edge connecting a vertex to the existing spanning tree. The Min-Heap allows quick updates to edge weights and ensures that the minimum-weight edge can be retrieved in O(logV) time, where V is the number of vertices. Steps: • Initialize a Min-Heap with all vertices, starting with an arbitrary vertex having weight 0. • Update the heap when shorter edges are discovered. • Extract the vertex with the minimum edge weight, adding it to the Minimum Spanning Tree (MST). This data structure optimizes the algorithm's overall complexity to O(ElogV), making it suitable for dense graphs. Why Other Options Are Incorrect: 1. Binary Search Tree: Inefficient for handling dynamic updates and retrieval of minimum elements. 2. Adjacency List: Represents graph structure but does not facilitate edge selection. 3. Adjacency Matrix: Useful for graph representation but inefficient for edge extraction in MST. 4. Disjoint Set: Used in Kruskal’s Algorithm to detect cycles, not for edge selection in Prim’s Algorithm. Min-Heaps are integral to Prim’s efficiency in handling dynamic graph traversal during MST construction.
In case of mutually exclusive projects and when NPV and IRR giving conflicting results, go for the project having higher IRR
In which of the following state Nag River flow?
राजस्थान के किस जिले में सर्वाधिक लिंगानुपात है ?
Where and when was the Ghadar Party founded?
How many states do the biodiversity-rich Western Ghats span across in India?
The first Football World Cup final was played between:
1. Every year the annual meeting of World Economic Forum is held in Davos. It is a cityin:
Which cities does the first Namo Bharat Rapid Rail connect?
Who is the International Chess Federation (FIDE) Deputy President?
Who will take charge as director of cricket at the National Cricket Academy (NCA) in Bengaluru?