static void Main(string[] args) { Binary_Tree tree = new Binary_Tree(); tree.Insert(50); tree.Insert(2); tree.Insert(7); tree.Insert(94); tree.Insert(24); tree.Insert(24); tree.Insert(71); tree.Insert(30); tree.Insert(49); Console.WriteLine("Count: " + tree.Count()); // Should be 9 Console.WriteLine("Min: " + tree.Min(tree.Root).Value); // Should be 2 Console.WriteLine("Max: " + tree.Max(tree.Root).Value); // Should be 94 Console.WriteLine("Depth: " + tree.Depth(tree.Root)); // Should be 7 tree.Print(tree.Root); // Prints the values in order Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Printing Values between 3 and 60"); tree.PrintInRange(tree.Root, 3, 60); // Prints the values in order Console.Write("\n\n"); Console.WriteLine("=====================================\n"); Console.WriteLine(""); tree.Delete(49); // test for value not in tree tree.Delete(51); // test for value not in tree tree.Delete(50); tree.Delete(2); tree.Delete(7); tree.Delete(94); tree.Delete(24); tree.Delete(24); tree.Delete(71); tree.Delete(30); tree.Delete(49); Console.WriteLine("Count: " + tree.Count()); // Should be 0 Console.WriteLine("Min: " + tree.Min(tree.Root).Value); // Should be -1 Console.WriteLine("Max: " + tree.Max(tree.Root).Value); // Should be -1 Console.WriteLine("Depth: " + tree.Depth(tree.Root)); // Should be 0 tree.Print(tree.Root); // Prints the values in order Console.ReadLine(); }
private void Show_OnClick(object sender, RoutedEventArgs e) { Binary_Tree binaryTree = new Binary_Tree(ref myTree); binaryTree.ShowDialog(); }