Trivia ForgePlay free →

Which graph algorithm uses a greedy approach to find the shortest path from a single source to all other vertices in a graph with non-negative weights?

Show answer

Dijkstra's algorithm

Dijkstra's algorithm maintains a set of visited vertices and repeatedly selects the unvisited vertex with the smallest tentative distance. It is typically implemented with a priority queue to achieve O(E + V log V) complexity with a Fibonacci heap.

Also asked as:
  • Which greedy algorithm finds the shortest paths from a single source to all other vertices in a graph, provided all edge weights are non-negative?

Would you remember this in 6 months?

Trivia Forge uses spaced repetition so facts stick. Free, no signup needed.

Turn on Algorithms practice →

More Algorithms trivia

See all 83 →