Which of the following is NOT a characteristic of Dijkstra's algorithm?
Practice Questions
Q1
Which of the following is NOT a characteristic of Dijkstra's algorithm?
It uses a greedy approach
It guarantees the shortest path
It can be used for negative weights
It requires a priority queue
Questions & Step-by-Step Solutions
Which of the following is NOT a characteristic of Dijkstra's algorithm?
Step 1: Understand what Dijkstra's algorithm is. It is a method used to find the shortest path from one point to another in a graph.
Step 2: Know that Dijkstra's algorithm works with graphs that have non-negative weights. This means all the values (or weights) on the edges of the graph must be zero or positive.
Step 3: Identify what negative weights are. Negative weights are values that are less than zero, which can create problems in finding the shortest path.
Step 4: Realize that if a graph has negative weights, Dijkstra's algorithm cannot be used effectively because it may not give the correct shortest path.
Step 5: Conclude that the characteristic of Dijkstra's algorithm that is NOT true is that it can handle graphs with negative weights.