×

Multiple-Choice Questions

Why is the Floyd-Warshall algorithm better suited for dense graphs rather than sparse graphs?

31. Why is the Floyd-Warshall algorithm better suited for dense graphs rather than sparse graphs?

  1. It has a lower time complexity for dense graphs.
  2. It runs in constant time for dense graphs.
  3. It ignores the number of edges in the graph.
  4. It performs the same regardless of graph density.

Answer

The correct answer is: C) It ignores the number of edges in the graph.

Explanation

The Floyd-Warshall algorithm runs in O(V^3) time regardless of the number of edges.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.