| | | | | |

Lazy Removal 3

    bool Retrieve(T& t) const
    {
      Node * n = root_;
      while(n)
      {
        if (pred_(t,n->value_))       // t < n->value_ : go left
          n = n->lchild_;
        else if (pred_(n->value_,t))  // t > n->value_ : go right
          n = n->rchild_;
        else if (n->IsAlive())        // found alive
        {
          t = n->value_;
          return 1;
        }
        else  // dead
          return 0;
      } // not found
      return 0;
    }

These BST methods require update to take dead nodes into account:

Insert, Get, Retrieve, RSize, RTraverse

In addition, all Iterator classes, and classes derived from BST_base, need to take the living sstatus of nodes into account.


| | Top of Page | 12. Binary Search Trees - 28 of 41