示例#1
0
        private static void HandLabeledTree()
        {
            Console.WriteLine("Hand-Labeled Tree:");

            var t = new TreeFactory <State_Content_Pair <string> >();

            var tree = t.Branch
                       (
                t.Leaf(new State_Content_Pair <string>(0, "a")),
                t.Branch
                (
                    t.Branch
                    (
                        t.Leaf(new State_Content_Pair <string>(1, "b")),
                        t.Leaf(new State_Content_Pair <string>(2, "c"))
                    ),
                    t.Leaf(new State_Content_Pair <string>(3, "d"))
                )
                       );

            tree.Show(2);
        }
示例#2
0
        private static Tree <string> UnlabeledTree()
        {
            Console.WriteLine("Unlabeled Tree:");

            var t = new TreeFactory <string>();

            var tree = new Branch <string>
                       (
                t.Leaf("a"),
                t.Branch
                (
                    t.Branch
                    (
                        t.Leaf("b"),
                        t.Leaf("c")
                    ),
                    t.Leaf("d")
                )
                       );

            tree.Show(2);

            return(tree);
        }