📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    What is the time complexity of the Floyd-Warshall

    algorithm for a graph with V vertices?
    A O(V) Correct Answer Incorrect Answer
    B O(V log V) Correct Answer Incorrect Answer
    C O(V²) Correct Answer Incorrect Answer
    D O(V³) Correct Answer Incorrect Answer
    E O(E log V) Correct Answer Incorrect Answer

    Solution

    The Floyd-Warshall algorithm has a time complexity of O(V³), where V is the number of vertices in the graph. This cubic complexity arises from its three nested loops, each iterating up to V times, which systematically update the shortest path distances.

    Practice Next
    More IT Operating System Questions
    ask-question