Esempio n. 1
0
 private void Add(ref Node node, Subscriber newCome)
 {
     if (node == null)
     {
         node = new Node(newCome);
     }
     else
     {
         node.children++;
         if (node.subscriber.Id > newCome.Id)
         {
             Add(ref node.left, newCome);
         }
         else
         {
             Add(ref node.right, newCome);
         }
     }
 }
Esempio n. 2
0
 public void Add(Subscriber subscriber)
 {
     Add(ref root, subscriber);
     Balancer();
 }
Esempio n. 3
0
 public Node(Subscriber subscriber)
 {
     this.subscriber = subscriber;
     this.left = null;
     this.right = null;
     this.children = 1;
 }