public AvlRotateOperations(TreeClass e, BinaryTreeNode <int> node) { this.tree = e; this.node = node; //如果是删除操作时 current就是被删的哪一个结点 如果是被加入时 cureent时被加入的节点的父节点 if (node.ParentTreeNode.Value > node.Value) { this.nodeLocation = "left"; } else { this.nodeLocation = "right"; } }
static void Main() { //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); Random random = new Random(); TreeClass a = new TreeClass(new BinaryTreeNode <int>(50)); for (int i = 0; i < 100; i++) { a.AddTo(new BinaryTreeNode <int>(random.Next(1, 100))); } a.AddTo(new BinaryTreeNode <int>(199)); a.Remove(new BinaryTreeNode <int>(50)); Console.WriteLine(a.Contains(new BinaryTreeNode <int>(199)).Item1); Console.WriteLine("总个数:{0}", a.Count()); }