In an unweighted, undirected connected graph, the shortest path from a node S to every other node is computed most efficiently, in terms of time complexity by
(A) Dijkstra’s algorithm starting from S.
(B) Warshall’s algorithm
(C) Performing a DFS starting from S.
(D) Performing a BFS starting from S.
Answer: (D)
Explanation:
* Time Comlexity of the Dijkstra’s algorithm is O(|V|^2 + E) * Time Comlexity of the Warshall’s algorithm is O(|V|^3) * DFS cannot be used for finding shortest paths * BFS can be used for unweighted graphs. Time Complexity for BFS is O(|E| + |V|)
Recommended Posts:
- Algorithms | Graph Shortest Paths | Question 13
- Algorithms | Graph Shortest Paths | Question 14
- Algorithms | Graph Shortest Paths | Question 2
- Algorithms | Graph Shortest Paths | Question 8
- Algorithms | Graph Shortest Paths | Question 3
- Algorithms | Graph Shortest Paths | Question 14
- Algorithms | Graph Shortest Paths | Question 7
- Algorithms | Graph Shortest Paths | Question 14
- Algorithms | Graph Shortest Paths | Question 9
- Algorithms | Graph Shortest Paths | Question 10
- Algorithms | Graph Shortest Paths | Question 11
- Algorithms | Graph Shortest Paths | Question 12
- Algorithms | Graph Shortest Paths | Question 15
- Johnson’s algorithm for All-pairs shortest paths | Implementation
- Shortest path in a complement graph
- Number of paths from source to destination in a directed acyclic graph
- Algorithms | Graph Traversals | Question 9
- Algorithms | Graph Traversals | Question 8
- Algorithms | Graph Traversals | Question 2
- Algorithms | Graph Traversals | Question 9

