public BinarySearchTreeNode Insert(BinarySearchTreeNode root, int data) { if (root == null) { root = new BinarySearchTreeNode(data); return(root); } if (data < root.GetBinarySearchTreeNodeData()) { root.SetBinarySearchTreeNodeLeft(Insert(root.GetBinarySearchTreeNodeLeft(), data)); } else { root.SetBinarySearchTreeNodeRight(Insert(root.GetBinarySearchTreeNodeRight(), data)); } return(root); }
public void SetBinarySearchTreeRoot(BinarySearchTreeNode binarySearchTreeNode) { root = binarySearchTreeNode; }
public void SetBinarySearchTreeNodeRight(BinarySearchTreeNode binarySearchTreeNode) { right = binarySearchTreeNode; }
public BinarySearchTree(BinarySearchTreeNode binarySearchTreeNode) { root = binarySearchTreeNode; }
public void SetBinarySearchTreeNodeLeft(BinarySearchTreeNode binarySearchTreeNode) { left = binarySearchTreeNode; }