Exemplo n.º 1
0
        public void TestOne()
        {
            Tree root = new Tree(1);

            root.r       = new Tree(2);
            root.r.r     = new Tree(5);
            root.r.r.l   = new Tree(3);
            root.r.r.r   = new Tree(6);
            root.r.r.l.r = new Tree(4);

            Assert.AreEqual("1 2 3 4 5 6", TreeInorderTraversal.Inorder(root));
        }
Exemplo n.º 2
0
        public void TestIterative()
        {
            Tree root = new Tree(1);

            root.r       = new Tree(2);
            root.r.r     = new Tree(5);
            root.r.r.l   = new Tree(3);
            root.r.r.r   = new Tree(6);
            root.r.r.l.r = new Tree(4);

            //Assert.AreEqual("1 2 3 4 5 6", TreeInorderTraversal.inorder(root));
            Assert.AreEqual("1 2 3 4 5 6", TreeInorderTraversal.inorderagain(root));
            Assert.AreEqual("1 2 3 4 5 6", TreeInorderTraversal.InorderIterative(root));
        }