Aug2016 cs Q36

0. Match the following:
a. Prim's algorithmi. O(V2E)
b. Bellman-Ford algorithmii. O(VE lgV)
c. Floyd-warshall algorithmiii. O(E lgV)
d. Johnson's algorithmiv. O(V3)

Where V is the set of nodes and E is the set of edges in the graph.
Codes:

 abcd
(1)iiiiivii
(2)iiiiiiiv
(3)iiiiivii
(4)iiiiiiiv

  • Option : C
  • Explanation :
  • Prim’s algorithm takes O(E lgV) time.
  • Bellman-Ford algorithm takes O(V2E) time.
  • Floyd-Warshall algorithm takes O(V3) time.
  • Johnson’s algorithm takes O(VE lgV) time.
  • So, option (C) is correct.
Cancel reply
Cancel reply