Question DSA-STK-0008
EasyWhich traversal of a graph naturally uses a stack?
- A.
Level-order traversal
- B.
Breadth-first search
- C.
Depth-first search
- D.
Dijkstra's algorithm
Show answer and explanation
Answer: C
DFS goes as deep as possible, backtracking in LIFO order — explicitly with a stack or implicitly with recursion.