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.
In Which year the Imperial Bank of India was formed by the merger of the three Presidency Banks of Madras, Bombay, and Bengal?
Which of the following bank with Lendingkart to Offer Loans Online for MSMEs ?
Under ECLGS Scheme, ________ Cr is earmarked for hospitality sector?
Consider the following statement/s about Digital Lending Apps/Platforms (DLAs):
1. Mobile and web-based applications with user interface that fac...
Which act governs the regulation and supervision of NonBanking Financial Companies (NBFCs) in India?
Match List I to list II.
SEBI gave its final Nod to _______for Trading in Electronic Gold Receipt?
Bhagwant Man has become the 17 the Chief Minister of Punjab, He was also 2 time MP, Identify his parliamentary constituency ?
What is the primary role of the National Payments Corporation of India (NPCI)?
Which of the following is not a member of ‘Gulf Cooperation Council’?Â