| | | | | |

A Binary Search Tree Class API

  template <typename T, class P = TLessThan<T> >
  class BST
  {
    ...
  public:
    ...
    void     Insert      (const ValueType& t);              // unimodal 
    bool     Insert      (Iterator& i, const ValueType& t); // if position OK 
    size_t   Remove      (const ValueType& t);
    bool     Remove      (Iterator& i);
    void     Clear       ();

    Iterator Includes    (const ValueType& t) const; // returns LowerBound(t) if found, End() otherwise
    Iterator LowerBound  (const ValueType& t) const; // first traversed position i with t <= *i
    Iterator UpperBound  (const ValueType& t) const; // first traversed position i with t <  *i
    ...

    // proper type
             BST        ();
    explicit BST        (const P&);
             BST        (const BST&);
    virtual ~BST        ();
    BST&    operator=   (const BST&);
};

| | Top of Page | 12. Binary Search Trees - 7 of 27