Trivia ForgePlay free →

What is the time complexity of the Bellman-Ford algorithm?

Show answer

O(V * E)

Bellman-Ford is used for single-source shortest paths and is more versatile than Dijkstra because it can handle negative weight edges. It also detects negative cycles, which would otherwise make the shortest path undefined.

Also asked as:
  • What is the Big O time complexity of the Bellman-Ford algorithm in terms of vertices (V) and edges (E)?

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 →