Source of bst1.h


  1: /** @file bst1.h
  2: Contains the (partial) specification of a BinarySearchTree template class.
  3: */

  5: #ifndef BST1_H
  6: #define BST1_H

  8: template<typename DataType>
  9: struct TreeNode
 10: {
 11:     TreeNode* leftPtr;
 12:     DataType  data;
 13:     TreeNode* rightPtr;
 14: };
 15: /**<
 16: The underlying node type for storing nodes of a binary search tree.
 17: We assume that DataType is a type for which both operator< and 
 18: operator== are defined (either an appropriate built-in type, or 
 19: a class that overloads these operators).
 20: */


 23: template<typename DataType>
 24: class BinarySearchTree
 25: {
 26: public:         
 27:     BinarySearchTree();
 28:     /**<
 29:     The default constructor. Creates an empty BST.
 30:     */

 32: private:
 33:     TreeNode<DataType>* rootPtr;
 34: };

 36: #endif