Question

Using an explicit stack for iterative DFS starting at A, where each node's neighbors are pushed onto the stack in the listed order (A:[B,C,D], B:[E], C:[], D:[], E:[]), and nodes are visited when popped, what is the resulting DFS visit order?

A A, B, C, D, E
B A, C, D, B, E
C A, D, B, C, E
D A, D, C, B, E
E A, B, E, C, D
Practice Next

Hey! Ask a query

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)