예제 #1
0
        private void ConstructBaseTestTree()
        {
            _root   = new BinaryTreeNode <int>(7);
            _node4  = new BinaryTreeNode <int>(4);
            _node5  = new BinaryTreeNode <int>(5);
            _node8  = new BinaryTreeNode <int>(8);
            _node15 = new BinaryTreeNode <int>(15);
            _node20 = new BinaryTreeNode <int>(20);

            _root.LeftChild    = _node4;
            _root.RightChild   = _node15;
            _node15.LeftChild  = _node8;
            _node15.RightChild = _node20;
            _node4.RightChild  = _node5;

            _sutRoot   = new BinaryTreeNode <int>(7);
            _sutNode4  = new BinaryTreeNode <int>(4);
            _sutNode15 = new BinaryTreeNode <int>(15);
            _sutNode8  = new BinaryTreeNode <int>(8);
            _sutNode5  = new BinaryTreeNode <int>(5);
            _sutNode20 = new BinaryTreeNode <int>(20);

            _tree = new BinarySearchTree <int>(_sutRoot);
            _tree.AddNodes(_sutNode4, _sutNode5, _sutNode8, _sutNode15, _sutNode20);

            _sutRoot.LeftChild    = _sutNode4;
            _sutRoot.RightChild   = _sutNode15;
            _sutNode15.LeftChild  = _sutNode8;
            _sutNode15.RightChild = _sutNode20;
            _sutNode4.RightChild  = _sutNode5;
        }