private BstNode FindLargest(BstNode rootNode = null) { if (rootNode != null) { if (rootNode.RightNode == null) { return(rootNode); } return(FindLargest(rootNode.RightNode)); } return(null); }
private BstNode Insert(int data, BstNode theNode) { if (theNode == null) { return(new BstNode(data)); } if (data < theNode.Data) { theNode.LeftNode = Insert(data, theNode.LeftNode); } else { theNode.RightNode = Insert(data, theNode.RightNode); } return(theNode); }
public BinarySearchTree(int data) { RootNode = new BstNode(data); }