Q. In Dijkstra's algorithm, what data structure is typically used to keep track of the shortest path estimates?
A.
Array
B.
Linked List
C.
Stack
D.
Priority Queue
Solution
A priority queue is used to keep track of the shortest path estimates in Dijkstra's algorithm, allowing efficient retrieval of the next vertex with the smallest distance.
Q. What is the main disadvantage of Dijkstra's algorithm compared to the A* algorithm?
A.
Dijkstra's algorithm is slower.
B.
Dijkstra's algorithm cannot handle graphs with cycles.
C.
Dijkstra's algorithm does not use heuristics.
D.
Dijkstra's algorithm is less accurate.
Solution
The main disadvantage of Dijkstra's algorithm compared to the A* algorithm is that Dijkstra's does not use heuristics, which can lead to longer search times in certain scenarios.
Correct Answer:
C
— Dijkstra's algorithm does not use heuristics.
Q. Which of the following is NOT a valid implementation of Dijkstra's algorithm?
A.
Using an adjacency matrix.
B.
Using an adjacency list with a binary heap.
C.
Using a linked list for the priority queue.
D.
Using a Fibonacci heap.
Solution
Using a linked list for the priority queue is not efficient for Dijkstra's algorithm, as it does not provide optimal time complexity for extracting the minimum.
Correct Answer:
C
— Using a linked list for the priority queue.