Explanation : Given: A complete graph on n vertices?
To find: Time complexity of Bellman-Ford Single
source shortest path.
Analysis:
Time complexity of Bellman-ford algorithm on a
graph with n vertices and m edges is O(nm)
For a complete graph, m = nC2 = 0(n2) (Since, there
is an edge between all pair of vertices)
∴ Time Complexity = 0(n2.n) = 0(n3)
∴ Solution is (C)
Note : Include vertex of degree zero in even degree
vertices.
Explanation : The problem can be solved using matrix chain
multiplication. we get minimum number of
multiplication using
((M1
× M2
) × M3
) ×
M4
)
= 100 × 20 × 5 + 10 × 100 × 5 + 10 × 5 × 80
= 19000.