What is the primary limitation of Dijkstra's algorithm?

Practice Questions

Q1
What is the primary limitation of Dijkstra's algorithm?
  1. It cannot find paths in directed graphs.
  2. It cannot handle negative weight edges.
  3. It is not efficient for dense graphs.
  4. It requires a complete graph.

Questions & Step-by-Step Solutions

What is the primary limitation of Dijkstra's algorithm?
  • Step 1: Understand what Dijkstra's algorithm is. It is a method used to find the shortest path in a graph.
  • Step 2: Know that a graph is made up of nodes (or points) and edges (or connections between points).
  • Step 3: Recognize that edges can have weights, which represent the cost or distance to travel from one node to another.
  • Step 4: Learn that Dijkstra's algorithm works well when all edge weights are positive (greater than zero).
  • Step 5: Identify the limitation: Dijkstra's algorithm does not work correctly if there are edges with negative weights.
  • Step 6: Understand that negative weight edges can cause the algorithm to give wrong answers about the shortest path.
No concepts available.
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely