コード例 #1
0
        public void TestTwo()
        {
            Tree root = new Tree(1);

            root.l = new Tree(2);
            Assert.AreEqual(1, TreeHeight.HeightRecursiveZZ(root));
            Assert.AreEqual(1, TreeHeight.HeightStackIterative(root));
        }
コード例 #2
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(4, TreeHeight.HeightRecursive(root));
            Assert.AreEqual(4, TreeHeight.HeightStackIterative(root));
        }