Example #1
0
        public void MinTest()
        {
            if (tree.Root == null)
            {
                TreeComplite();
            }
            TreeAlgorithm tree1 = new TreeAlgorithm();

            tree1.Add(-69);
            tree1.Add(-15);
            tree1.Add(-36);
            tree1.Add(-17);
            TreeAlgorithm tree2 = new TreeAlgorithm();

            Assert.AreEqual(4, tree.Min().Value);
            Assert.AreEqual(-69, tree1.Min().Value);
            Assert.IsNull(tree2.Max());
        }
Example #2
0
        public void MaxTest()
        {
            if (tree.Root == null)
            {
                TreeComplite();
            }
            TreeAlgorithm tree1 = new TreeAlgorithm();

            tree1.Add(-23);
            tree1.Add(-36);
            tree1.Add(-43);
            tree1.Add(-2);
            TreeAlgorithm tree2 = new TreeAlgorithm();

            Assert.AreEqual(66, tree.Max().Value);
            Assert.AreEqual(-2, tree1.Max().Value);
            Assert.IsNull(tree2.Max());
        }