Greedy-approach
October 26, 2023
GATE 1997
October 26, 2023
Greedy-approach
October 26, 2023
GATE 1997
October 26, 2023

Greedy-approach

Question 22
The time required to find shortest path in a graph with n vertices and e edges is :
A
O(e)
B
O(n)
C
O(e2)
D
O(n2)
Question 22 Explanation: 
→ We can use dijkstra’s algorithm to find shortest path in a graph with n vertices and e edges is O(ElogV).
→ We know that E ≤ V2 if graph is complete and time complexity is O(n2)
Correct Answer: D
Question 22 Explanation: 
→ We can use dijkstra’s algorithm to find shortest path in a graph with n vertices and e edges is O(ElogV).
→ We know that E ≤ V2 if graph is complete and time complexity is O(n2)

Leave a Reply

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