Chapter Index | Slide Index | Frames [ Windows ] | Narrative On | <- prev | next -> |

BST API Simplified

  template <typename T, class P = TLessThan<T> >
  class BSTLite
  {
    ...
  public:
    T&       Get        (const T& t);   // "associative array" semantics
    void     Put        (const T& t);   // unimodal insert
    bool     Retrieve   (T& t) const;   // if found sets t to result
    ...

    // proper type
             BST        ();
    explicit BST        (const P&);     // specify predicate object
             BST        (const BST&);
    virtual ~BST        ();
    BST&    operator=   (const BST&);
};
  • Very useful
  • Iterator free!

<- prev | next -> | Top of Page | 12. Binary Search Trees - 9 of 27