Beispiel #1
0
 void insert(int d) {
   if( d <= data) {
     if (left != NULL) left->insert(d);
     else left = new RankNode(d);
     left_size++;
   } else {
     if (right != NULL) right->insert(d);
     else right = new RankNode(d);
   }
 }
Beispiel #2
0
 void track(int number) {
   if (root == NULL) {
     root = new RankNode(number);
   } else {
     root->insert(number);
   }
 }
 void insert(int d) {
     if (d <= data) {
         if (left != nullptr) {
             left->insert(d);
         } else {
             left = new RankNode(d);
             left_size++;
         }
     } else {
         if (right != nullptr) {
             right->insert(d);
         } else {
             right = new RankNode(d);
         }
     }
 }