I have this method to perform depth first search on the binary tree
class Node
{
public Node Left { get; set; }
public Node Right { get; set; }
public int value { get; set; }
public void DepthFirst(Node node)
{
if (node != null)
{
Console.WriteLine(node.value + " ");
DepthFirst(node.Left);
DepthFirst(node.Right);
}
}
}
and now I have to use iterative deepening depth first search instead, I know how iterative deepening works but I have no idea how do I implement it.
I don't need any goal, the only purpose is to search the tree and output the node values.
EDIT: I don't have any code that I wrote for the Iterative Deepening, that's what I'm asking for.
I fixed it. The problem was at the python code below