예제 #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);
   }
 }
예제 #2
0
 void track(int number) {
   if (root == NULL) {
     root = new RankNode(number);
   } else {
     root->insert(number);
   }
 }
예제 #3
0
 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);
         }
     }
 }