How do I progress from Depth First Search algorithm to Iterative Deepening with Binary Tree in C#

179 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

I fixed it. The problem was at the python code below