Пример #1
0
        void Remove()
        {
            int value = Convert.ToInt32(input_Remove.text);

            intTree.Remove(value);
            RefreshOutput();
        }
Пример #2
0
        public void BinarySearchTree_04_Remove_02_OnNonEmptyTree_ElementNotExisting()
        {
            // Arrange
            IBinarySearchTree <int> tree = DSBuilder.CreateBinarySearchTreeIntModerate();


            // Act & Assert
            Assert.Throws(typeof(BinarySearchTreeElementNotFoundException), () => tree.Remove(40));
        }
Пример #3
0
        public void BinarySearchTree_04_Remove_01_OnEmptyTree()
        {
            // Arrange
            IBinarySearchTree <int> tree = DSBuilder.CreateBinarySearchTreeIntEmpty();


            // Act & Assert
            Assert.Throws(typeof(BinarySearchTreeElementNotFoundException), () => tree.Remove(1));
        }
Пример #4
0
        public void BinarySearchTree_04_Remove_06_OnNonEmptyTree_ElementWithBothChilds()
        {
            // Arrange
            IBinarySearchTree <int> tree = DSBuilder.CreateBinarySearchTreeIntModerate();
            string expected = "[ [ NIL 3 [ [ NIL 7 NIL ] 8 [ NIL 12 NIL ] ] ] 17 [ [ NIL 24 NIL ] 26 [ [ NIL 34 [ [ NIL 37 NIL ] 42 NIL ] ] 45 [ NIL 50 NIL ] ] ] ]";

            // Act
            tree.Remove(32);
            string actual = tree.ToInfixString();

            // Assert
            Assert.AreEqual(expected, actual);
        }