BST Code

 

// Assumptions:  Relational operators overloaded 
  class TreeType
  {
  public:
    // Constructor, destructor, copy constructor
    ...
    // Overloads assignment
    ...
    // Observer functions
    ...
    // Transformer functions
    ...
    // Iterator pair
    ...
    void Print(std::ofstream& outFile) const;
  private:
    TreeNode* root;
  };


bool TreeType::IsFull() const
{
  NodeType* location;
  try
  {
    location = new NodeType;
    delete location;
    return false;
  }
  catch(std::bad_alloc exception)
  {
    return true;
  }
}

bool TreeType::IsEmpty() const
{
  return root == NULL;
}


© Lynne Grewe