Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class bstdata>
- BST<bstdata>::BST():root(NULL){};
- template <class bstdata>
- BST<bstdata>::~BST(){
- destructorHelper(root);
- }
- template<class bstdata>
- void BST<bstdata>::destructorHelper(NodePtr root)
- {
- if(!root->left)
- destructorHelper(root->left);
- if(!root->right)
- destructorHelper(root->right);
- if(root!=NULL)
- delete root;
- }
- template <class bstdata>
- bool BST<bstdata>::isEmpty()
- {
- if(root==NULL)
- return true;
- else
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement