Intermediate
Data Structures & Algorithms
Q48 / 100
What is the Bellman-Ford algorithm's advantage over Dijkstra's?
Correct! Well done.
Incorrect.
The correct answer is B) It handles negative edge weights and detects negative cycles
B
Correct Answer
It handles negative edge weights and detects negative cycles
Explanation
Bellman-Ford relaxes all edges V-1 times in O(VE) time. It works with negative weights and detects negative cycles (if relaxation occurs on the V-th pass).
Progress
48/100