예제 #1
0
        public BineryTreeNode(T value, BineryTreeNode <T> leftChild, BineryTreeNode <T> rightChild)
        {
            if (value == null)
            {
                throw new ArgumentNullException("Cannot insert null values!");
            }

            this.value      = value;
            this.leftChild  = leftChild;
            this.rightChild = rightChild;
        }
예제 #2
0
        public BineryTree(T value, BineryTree <T> leftChild, BineryTree <T> rightChild)
        {
            if (value == null)
            {
                throw new ArgumentNullException("Cannot insert null values!");
            }

            BineryTreeNode <T> leftChildNode  = leftChild != null ? leftChild.root : null;
            BineryTreeNode <T> rightChildNode = rightChild != null ? rightChild.root : null;

            this.root = new BineryTreeNode <T>(value, leftChildNode, rightChildNode);
        }