#ifndef BINARYTREE_ #define BINARYTREE_ #include "BinaryNode.h" #include using namespace std; template class BinarySearchTree { private: BinaryNode * root; int size; BinaryNode *find (T item, BinaryNode *t) ; bool insert(T item, BinaryNode *&t) ; void remove (T item, BinaryNode *&t); void clear(BinaryNode *& t) ; public: BinarySearchTree() { root =nullptr; size=0; } //end constructor ~BinarySearchTree() { clear(root); } BinaryNode * find(T item) { return find (item, root); } bool insert (T item); BinaryNode *findMax (BinaryNode *t) ; BinaryNode *findMin (BinaryNode *t) ; int getSize() { return size;} int isEmpty() { return size ==0;} }; template BinaryNode * BinarySearchTree:: find (T item, BinaryNode *t) { //so what code goes here? //this return is left only for compiler reason, you should remove it. return nullptr; } template bool BinarySearchTree:: insert (T item) { bool inserted = insert(item, root); if (inserted) size++; return inserted; } template bool BinarySearchTree:: insert (T item, BinaryNode *&t) { //so what goes here? return false; } template void BinarySearchTree:: clear(BinaryNode *& t) { if (t == nullptr) return; else { clear(t->left); clear(t->right); delete(t); t = nullptr; } } template BinaryNode * BinarySearchTree::findMin (BinaryNode *t) { if ( t == nullptr ) return nullptr; else if ( t -> left == nullptr ) return t; return findMin (t -> left); } template BinaryNode* BinarySearchTree::findMax (BinaryNode *t) { if ( t == nullptr ) return nullptr; else if ( t -> right == nullptr ) return t; return findMax (t ->right); } template void BinarySearchTree::remove (T item, BinaryNode *&t) { if ( t == nullptr) return; // Item not found; do nothing //so what is the rest of the code? } #endif