Esempio n. 1
0
    //test case
    static void Main(string[] args)
    {
        var c = new Node <char>('C');
        var e = new Node <char>('E');
        var h = new Node <char>('H');
        var a = new Node <char>('A');
        var d = new Node <char>('D', c, e);
        var i = new Node <char>('I', h);
        var b = new Node <char>('B', a, d);
        var g = new Node <char>('G', right: i);
        var f = new Node <char>('F', b, g);

        Console.Write("Level order traversal sequence: ");
        foreach (var x in TreeTraversal.AsBreadthFirst(f))
        {
            Console.Write(x + " ");
        }
        Console.WriteLine();
    }