📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    Dijkstra's algorithm, used for finding the shortest

    paths from a single source to all other vertices in a graph with non-negative edge weights, is an example of which algorithmic paradigm?
    A Dynamic Programming Correct Answer Incorrect Answer
    B Divide and Conquer Correct Answer Incorrect Answer
    C Backtracking Correct Answer Incorrect Answer
    D Greedy Algorithm Correct Answer Incorrect Answer
    E Brute Force Correct Answer Incorrect Answer

    Solution

    Dijkstra's algorithm is a greedy algorithm. At each step, it selects the unvisited vertex with the smallest known distance from the source and marks it as visited, then updates the distances of its neighbors. This locally optimal choice (picking the closest unvisited vertex) leads to a globally optimal solution for shortest paths in graphs with non-negative edge weights.

    Practice Next
    ask-question