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.
The SBI report shows a 74.2% decline in income disparity among those earning up to:
Which Indian bank received a $500 million loan from the International Finance Corporation (IFC) to support green project financing?
Who is known as āMr Tomboyā and secured a historic bronze medal for India in eFootball at the 2024 Asian Esports Games?
Bharat Bill Payment System (BBPS) is an integrated bill payment system in India offering interoperable and accessible bill payment service to customers....
In 2023, how much did the fundraising through Initial Public Offerings (IPOs) drop compared to the previous year?
Which instrument from Varanasi recently received the Geographical Indication (GI) tag?
Who will be the torchbearer for the Paris 2024 Olympic Torch Relay?
Where was the 40th National Youth Basketball Championships held?
Under the National Livestock Mission, how many breed multiplication farms have been established for pigs?
Which private sector e-commerce company launched a new platform with a focus on development in rural areas and providing equitable access to growth oppo...