1.

What is the running time of the Floyd Warshall Algorithm?(a) Big-oh(V)(b) Theta(V^2)(c) Big-Oh(VE)(d) Theta(V^3)I got this question during an interview.I want to ask this question from Shortest Path topic in section Shortest Path of Data Structures & Algorithms II

Answer»

Right ANSWER is (d) Theta(V^3)

Explanation: The running TIME of the Floyd Warshall algorithm is determined by the TRIPLY nested for LOOPS. Since each execution of the for LOOP takes O(1) time, the algorithm runs in time Theta(V^3).



Discussion

No Comment Found

Related InterviewSolutions