Algorithms and Data Structures · Middle · Question 58 of 75

What does Dijkstra's algorithm compute?

Explanation

It repeatedly takes the unvisited vertex with the smallest known distance (from a priority queue) and relaxes its edges. With a binary heap it runs in O((V + E) log V). Negative weights break it.

Further reading

Problem with a question

Algorithms and Data Structures · Middle · question 58

Test yourself

Take the Algorithms and Data Structures · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz