Which of the following is a greedy algorithm?

2025

Which of the following is a greedy algorithm?

  1. A.

    Dijkstra's algorithm

  2. B.

    Merge Sort

  3. C.

    Quick Sort

  4. 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.

Explore the full course: Tpsc Assistant Technical Officer