DSSSB TGT CS Mock 04 – Question 105

Question:

What is the time complexity of the Floyd-Warshall all-pairs shortest paths algorithm on a graph with \(V\) vertices?
\(V\) शीर्षों वाले ग्राफ पर फ़्लॉइड-मार्शल ऑल-पेयर्स शॉर्टेस्ट पाथ कलनविधि की समय जटिलता क्या है?

Options:

  • \(\Theta(V^3)\)
  • \(\Theta(V^2 \log V)\)
  • \(\Theta(V \cdot E)\)
  • \(\Theta(E \log V)\)
  • \(\Theta(V^3)\)
  • \(\Theta(V^2 \log V)\)
  • \(\Theta(V \cdot E)\)
  • \(\Theta(E \log V)\)

Correct Answer: a)

Explanation:

Floyd-Warshall uses three nested loops running \(V\) iterations each to update distance matrix \(D[i][j] = \min(D[i][j], D[i][k] + D[k][j])\), requiring \(\Theta(V^3)\) time.
फ़्लॉइड-मार्शल एल्गोरिदम तीन नेस्टेड लूप्स का उपयोग करता है, अतः इसकी समय जटिलता \(\Theta(V^3)\) होती है।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top