Exemple #1
0
        public void Test23()
        {
            // Arrange
            var tree = CreateTree(new[] { 5, 3, 6, 2, 4, 1000, 1000, 1 });

            // Act
            var value = new TreeNode.Solution().KthSmallest3(tree, 6);

            // Assert
            Assert.AreEqual(6, value);
        }
Exemple #2
0
        public void Test13()
        {
            // Arrange
            var tree = CreateTree(new[] { 3, 1, 4, 1000, 2 });

            // Act
            var value = new TreeNode.Solution().KthSmallest3(tree, 1);

            // Assert
            Assert.AreEqual(1, value);
        }
Exemple #3
0
        public void Test43()
        {
            // Arrange
            var tree = CreateTree(new[]
            {
                0, 1000, 1, 1000, 3, 2
            });

            // Act
            var value = new TreeNode.Solution().KthSmallest3(tree, 3);

            // Assert
            Assert.AreEqual(2, value);
        }
Exemple #4
0
        public void Test33()
        {
            // Arrange
            var tree = CreateTree(new[]
            {
                45, 30, 46, 10, 36, 1000, 49, 8, 24, 34, 42, 48, 1000, 4, 9, 14, 25, 31, 35, 41, 43, 47, 1000, 0, 6
                , 1000, 1000, 11, 20, 1000, 28, 1000, 33, 1000, 1000, 37, 1000, 1000, 44, 1000, 1000, 1000, 1, 5, 7
                , 1000, 12, 19, 21, 26, 29, 32, 1000, 1000, 38, 1000, 1000, 1000, 3, 1000, 1000, 1000, 1000, 1000, 13
                , 18, 1000, 1000, 22, 1000, 27, 1000, 1000, 1000, 1000, 1000, 39, 2, 1000, 1000, 1000, 15, 1000, 1000
                , 23, 1000, 1000, 1000, 40, 1000, 1000, 1000, 16, 1000, 1000, 1000, 1000, 1000, 17
            });

            // Act
            var value = new TreeNode.Solution().KthSmallest3(tree, 32);

            // Assert
            Assert.AreEqual(31, value);
        }