public BST Insert(int value) { if (this.value > value) { if (left == null) { left = new BST(value); } else { left.Insert(value); } } else if (this.value < value) { if (right == null) { right = new BST(value); } else { right.Insert(value); } } else if (this.value == value) { if (right == null) { right = new BST(value); } else { right.Insert(value); } } return(this); }
static BST CreateBST2() { BST root = new BST(1); return(root); }