public void Exists(int value) { if (root.Find(value) != null) { Console.WriteLine("Value {0} appears in the tree", value); } else { Console.WriteLine("Value {0} is not in the tree", value); } }
public Node Find(int data) { if (root != null) { return(root.Find(data)); } else { Console.WriteLine("Node not found!"); return(null); } }
public static void Main(string[] args) { Node testBinaryTree = new Node(0); for (int i = 1, count = (int)(Math.Pow(2, 12)) - 1; i < count; i++) { Node.RandomInsert(ref testBinaryTree, i); } long totalWeight = Node.GetTotalWeight(testBinaryTree); Node largestSubtree = Node.FindLargestSubtree(testBinaryTree); Node foundNode = Node.Find(testBinaryTree, 16); }
public void Find(int val) { if (value != val) { if (val < value && CheckNull(childLeftNode, val)) { childLeftNode.Find(val); BTree.path += ",L"; } if (val > value && CheckNull(childRightNode, val)) { childRightNode.Find(val); BTree.path += ",R"; } } }
public void Find(int val) { foundValue = true; if (root != null) { root.Find(val); } else { foundValue = false; path = ""; } }
public bool Search(int s) { return(_root.Find(_root, s)); }