Exemple #1
0
 public void Insert(int value)//logn
 {
     if (value > Data)
     {
         if (Right != null)
         {
             Right.Insert(value);
         }
         else
         {
             Right     = new AVL(value);
             Right.Mum = this;
             Right.SetTree(tree);
             Console.WriteLine("found_place"); tree.Print_tree(); tree.Height_print();
             Right.Cal_heigh();
         }
     }
     else
     {
         if (Left != null)
         {
             Left.Insert(value);
         }
         else
         {
             Left     = new AVL(value);
             Left.Mum = this;
             Left.SetTree(tree);
             Console.WriteLine("found_place"); tree.Print_tree(); tree.Height_print();
             Left.Cal_heigh();
         }
     }
 }
Exemple #2
0
 public void Insert(int value)//Insert(T value)
 {
     if (root == null)
     {
         root = new AVL(value);
         root.SetTree(this);
     }
     else
     {
         root.Insert(value);
     }
 }
Exemple #3
0
 public AVL_Tree(AVL left, int data, AVL right)//AVL_Tree(AVL left, T data, AVL right)
 {
     root = new AVL(data, right, left);
     root.SetTree(this);
 }
Exemple #4
0
 public AVL_Tree(int data)//AVL_Tree(T data)
 {
     root = new AVL(data);
     root.SetTree(this);
 }