Q. Which algorithm is more suitable for finding the shortest path in a graph with negative weights?
-
A.
Dijkstra's Algorithm
-
B.
Bellman-Ford Algorithm
-
C.
A* Search Algorithm
-
D.
Floyd-Warshall Algorithm
Solution
The Bellman-Ford algorithm is suitable for finding the shortest path in graphs with negative weights.
Correct Answer:
B
— Bellman-Ford Algorithm
Learn More →
Q. Which of the following is a characteristic of Dijkstra's algorithm?
-
A.
It uses depth-first search.
-
B.
It guarantees the shortest path in all cases.
-
C.
It can be used for both directed and undirected graphs.
-
D.
It requires all edge weights to be the same.
Solution
Dijkstra's algorithm can be used for both directed and undirected graphs, provided that all edge weights are non-negative.
Correct Answer:
C
— It can be used for both directed and undirected graphs.
Learn More →
Showing 1 to 2 of 2 (1 Pages)