Question

    In the design and analysis of algorithms, which of the

    following algorithms is based on the greedy approach?
    A Merge Sort Correct Answer Incorrect Answer
    B Dijkstra’s Algorithm Correct Answer Incorrect Answer
    C Depth-First Search Correct Answer Incorrect Answer
    D Bellman-Ford Algorithm Correct Answer Incorrect Answer
    E Quick Sort Correct Answer Incorrect Answer

    Solution

    Dijkstra’s algorithm is based on the greedy approach, which selects the locally optimal solution at each step with the goal of finding the shortest path from the source to all other vertices in a graph. The algorithm repeatedly picks the nearest unvisited vertex and calculates the shortest path to all its neighbors, ensuring optimal solutions for each subproblem. Merge Sort : A divide-and-conquer algorithm, not greedy. Depth-First Search : DFS is a traversal technique, not a greedy algorithm. Bellman-Ford Algorithm : This algorithm can handle negative weight edges, but it is not based on the greedy approach. Quick Sort : A divide-and-conquer algorithm, not greedy.

    Practice Next