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

  • google app store apple app store
  • ✖

      Question

      The time complexity of computing the all-pairs shortest

      paths in a dense graph with V vertices using Floyd–Warshall is:
      A (V + E) Correct Answer Incorrect Answer
      B O(V²) Correct Answer Incorrect Answer
      C O(V³) Correct Answer Incorrect Answer
      D O(V² log V) Correct Answer Incorrect Answer
      E O(VE) Correct Answer Incorrect Answer

      Solution

      Floyd–Warshall updates distances via triple nested loops over vertices resulting in O(V³) time.

      Practice Next
      ask-question