-->
当前位置:首页 > 题库

单选题:Why doesn't Floyd algorithm work if there are negative-cost cycl

Luz5年前 (2021-05-10)题库1140
Why doesn't Floyd algorithm work if there are negative-cost cycles?



A.Because Floyd didn't like negative numbers.
B.Because Floyd algorithm will terminate after finite steps, yet the shortest distance is negative infinity if there is a negative-cost cycle.
C.Because Floyd algorithm will fall into infinite loops.
D.Because a negative-cost cycle will result in a negative D[i][i], yet Floyd algorithm can only accept positive weights.


答案:B