Skip to content
RED SAGSkills
hard20 pts · first answer countsstacks-and-queues

Iterative DFS visits in a different order

Recursive DFS visits a node's neighbours in list order A, B, C. Your stack-based version pushes A, B, C in that order and visits C first. How do you match the recursive order?

Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions