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


    Question

    Which of the following statements about Dijkstra’s

    algorithm is true?
    A Works with negative-weight edges but no negative cycles Correct Answer Incorrect Answer
    B Finds shortest paths for directed graphs with negative edges Correct Answer Incorrect Answer
    C Requires all edge weights to be non-negative to guarantee correctness Correct Answer Incorrect Answer
    D Is an algorithm for minimum spanning tree Correct Answer Incorrect Answer
    E Has worst-case time O(E^2) irrespective of data structures Correct Answer Incorrect Answer

    Solution

    Dijkstra assumes non-negative edge weights; with negative weights it may produce incorrect distances.

    Practice Next
    ask-question