Question
Which of the following algorithms is best suited for
finding the shortest path in a weighted graph where some edges may have negative weights but no negative cycles?Solution
The Bellman-Ford Algorithm (C) is best suited for finding the shortest path in graphs that may have negative weights but no negative cycles. It works by relaxing the edges up to (V-1) times, where V is the number of vertices, ensuring it can handle negative weights and detect negative cycles. Why Other Options Are Wrong: A) Dijkstra's Algorithm: Dijkstra’s algorithm is faster than Bellman-Ford for graphs with non-negative weights but fails when negative weights are present, as it assumes all edge weights are positive. B) Kruskal's Algorithm: This is a Minimum Spanning Tree (MST) algorithm used to connect all nodes in a graph with minimum weight, not to find the shortest path between two nodes. D) Prim’s Algorithm: Like Kruskal’s, Prim’s algorithm is used for finding an MST, not for finding the shortest path in a graph with negative weights. E) Floyd-Warshall Algorithm: This algorithm computes shortest paths between all pairs of vertices and works for both positive and negative weights, but it is not optimal for solving single-source shortest path problems.
Which of the following statements is/are correct?
I. Only marketed goods are considered while estimating Gross Domestic Product (GDP).
In the famous Bagwal fair of Devidhura which among the following does not participate?
Dree Utsav is celebrated in the state of ____________.
The Marylebone Cricket Club (MCC) has declared and awarded two Indian cricketers, name them?
Which of the following states stands at number one in terms of route kilometers at the end of the year 2019-20 as per the Indian Railways Yearbook 2019-20?
What does ‘P’ denote in PRAN a unique number provided under PFRDA?
Which of the following statements is true about Pradhan Mantri Vaya Vandana Yojana (PMVVY)?
1. It is a pension plan for senior citizens
<...SIMBEX is a military exercise conducted between the defense forces of which of the following nations?
Which reform was initiated by Lord Ripon for the welfare of labourers?
Successive discount of a% and b% are equivalent to a discount of