Exemplo n.º 1
0
 public void Track(int newValue)
 {
     if (root == null) {
         root = new RankTreeNode (newValue);
     } else {
         root.InsertValue (newValue);
     }
 }
 public void InsertValue(int newValue)
 {
     if (newValue <= Value) {
         LeftSize++;
         if (Left == null) {
             Left = new RankTreeNode (newValue);
         } else {
             Left.InsertValue (newValue);
         }
     } else {
         if(Right == null){
             Right = new RankTreeNode(newValue);
         }
         else{
             Right.InsertValue(newValue);
         }
     }
 }