GATE CS 2026 Set 2 | Question 37
Algorithms › Graph Algorithms · MCQ · 2 marks · Answer: A
- Question 37Algorithmsmcq2 marksLet be a weighted directed acyclic graph with edges and vertices. Given and a source vertex in , which one of the following options gives the worst case time complexity of the fastest algorithm to find the lengths of shortest paths from to all vertices that are reachable from in ?
- A.✓
- B.
- C.
- D.
Answer: A
Solution
Answer: (A) On a DAG, relaxing edges in topological order computes all single-source shortest paths in one linear pass. Topological sort plus the relaxations are both , so the fastest algorithm runs in (Dijkstra/Bellman-Ford are not needed). - A.
More GATE PYQ on Graph Algorithms
All GATE CS Algorithms PYQ →Attempt GATE CS 2026 Set 2 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →