public BSTNode(int number, BSTNode parent, BST tree) { Number = number; Left = null; Right = null; Parent = parent; Tree = tree; }
static void Main(string[] args) { BST tree = new BST(); tree.insertAVL(50); tree.insertAVL(2); tree.insertAVL(7); tree.insertAVL(94); tree.insertAVL(24); tree.insertAVL(24); tree.insertAVL(71); tree.insertAVL(30); tree.insertAVL(49); Console.WriteLine("Count: " + tree.count()); // Should be 9 Console.WriteLine("Min: " + tree.min()); // Should be 2 Console.WriteLine("Max: " + tree.max()); // Should be 94 Console.WriteLine("Depth: " + tree.depth()); // Should be 7 tree.prettyprint(); // Prints the values in order //tree.balance(); //tree.prettyprint(); 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()); // Should be -1 Console.WriteLine("Max: " + tree.max()); // Should be -1 Console.WriteLine("Depth: " + tree.depth()); // Should be 0 tree.prettyprint(); // Prints the values in order }