To implement DFS iteratively, a _______ can be used to keep track of nodes to visit next.

  • Linked list
  • Priority queue
  • Queue
  • Stack
To implement DFS iteratively, a stack data structure can be used to keep track of nodes to visit next. This follows the LIFO (Last In, First Out) principle, allowing the algorithm to explore as deeply as possible before backtracking.
Add your answer
Loading...

Leave a comment

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