What is the time complexity of Bellman-Ford single-source shortest path algorithm on a complete graph of n vertices?
Explanation: Time complexity of Bellman-Ford algorithm is where V is number of vertices and E is number edges (See this). If the graph is complete, the value of E becomes . So overall time complexity becomes
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.