Stack: []
Visiting: undefined
Current Path: undefined
Depth First Search (DFS) is an algorithm that explores a graph by going as deep as possible along each branch before backtracking. It uses a stack data structure to keep track of the nodes to visit next.
Depth-Limited Search: This is a variant of DFS where we limit the maximum depth of exploration. When the algorithm reaches the depth limit, it will backtrack even if there are unvisited neighbors.
How DFS Works: The algorithm starts at the root node and explores as far as possible along each branch before backtracking. It uses a stack to remember which nodes to visit next.
Why a Node is Chosen: The most recently discovered node is selected from the stack, following the "last in, first out" (LIFO) principle. The search only proceeds to the specified depth limit.