Question: #pragma once #includeBinaryTreeNode.h using namespace std; template class BSTree : public BinaryTree { protected: BinaryTreeNode * root; / / root of tree public: BSTree
#pragma once
#include"BinaryTreeNode.h
using namespace std;
template
class BSTree : public BinaryTree
protected:
BinaryTreeNode root; root of tree
public:
BSTree : rootNULL;
BSTreeconst BSTree&;
BSTreeT data root new BinaryTreeNodedata; ;
virtual ~BSTree if root delete root; ;
BinaryTreeNode getRoot
return root;
T findSmallestBinaryTreeNode nodep;
virtual bool insertBinaryTreeNode nodep, const T& x;
virtual const T const searchBinaryTreeNode nodep, const T& x;
virtual bool removeBinaryTreeNode nodep, const T& x;
;
template
T BSTree::findSmallestBinaryTreeNode nodep
if nodepGetLeftChild nullptr
return findSmallestnodepGetLeftChild;
This is the data contained within the smallest node
return nodepGetData;
template
const T const BSTree::searchBinaryTreeNode nodep, const T& x
if nodep
return NULL;
if x nodepGetData
return &nodepGetData;
if x nodepGetData
return searchnodepGetLeftChild x;
else
return searchnodepGetRightChild x;
template
bool BSTree::insertBinaryTreeNode nodep, const T& x
To Do: Write your code here
template
bool BSTree::removeBinaryTreeNode nodep, const T& x
To Do: Write your code here
You need to complete a BSTree Binary Search Tree class in the BSTree.h file. In
particular, this class inherits from the BinaryTree class. Thus, the parent functions
such as
PreOrderTraverseBinaryTreeNode
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
