Which of the following is a greedy algorithm?
2025
Which of the following is a greedy algorithm?
- A.
Dijkstra's algorithm
- B.
Merge Sort
- C.
Quick Sort
- D.
Bellman-Ford algorithm
Attempted by 67 students.
Show answer & explanation
Correct answer: A
A greedy algorithm builds a solution step by step by making the locally best choice at each step. Dijkstra's algorithm is greedy because it repeatedly selects the unvisited vertex with the minimum tentative distance and finalizes it. Merge Sort and Quick Sort are divide-and-conquer algorithms. Bellman-Ford uses repeated edge relaxation and is not greedy. Therefore, the correct answer is Dijkstra's algorithm.