...
Greedy-approach
October 26, 2023
TIFR PHD 2022
October 26, 2023
Greedy-approach
October 26, 2023
TIFR PHD 2022
October 26, 2023

Greedy-approach

Question 11
Which of the following algorithms is fastest to find shortest path from a source node to a destination node in an un-weighted connected graph?
A
Warshall’s algorithm
B
Floyd’s algorithm
C
Breadth First Traversal
D
Depth First Traversal
Question 11 Explanation: 
warshall algorithm will take O(n^3) time.
Floyd’s algorithm will take O(n^3) time.
Breadth First traversal will take O(m+n) time.
Depth first traversal will work only if the graph is tree.
Hence among the given options Breadth first traversal is best.
Correct Answer: C
Question 11 Explanation: 
warshall algorithm will take O(n^3) time.
Floyd’s algorithm will take O(n^3) time.
Breadth First traversal will take O(m+n) time.
Depth first traversal will work only if the graph is tree.
Hence among the given options Breadth first traversal is best.

Leave a Reply

Your email address will not be published. Required fields are marked *