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); } } }
public void Add(Subscriber subscriber) { Add(ref root, subscriber); Balancer(); }
public Node(Subscriber subscriber) { this.subscriber = subscriber; this.left = null; this.right = null; this.children = 1; }