Question: C + + , Visual Studio. I ' m working on a project with a header file BinaryNodeTree.h . I want it implemented into a

C++, Visual Studio. I'm working on a project with a header file BinaryNodeTree.h. I want it implemented into a .cpp file. I attached the header file below but due to some weird issue on this site it takes out the template and the includes. It includes memory and the template is class ItemType. I would appreciate a practical complete implementation and comments. BinaryNodeTree.h: #ifndef BINARY_NODE_TREE_
#define BINARY_NODE_TREE_
#include "BinaryTreeInterface.h"
#include "BinaryNode.h"
#include "PrecondViolatedExcept.h"
#include "NotFoundException.h"
#include
template
class BinaryNodeTree : public BinaryTreeInterface
{
private:
std::shared_ptr> rootPtr;
protected:
int getHeightHelper(std::shared_ptr> subTreePtr) const;
int getNumberOfNodesHelper(std::shared_ptr> subTreePtr) const;
auto balancedAdd(std::shared_ptr> subTreePtr, std::shared_ptr> newNodePtr);
virtual auto removeValue(std::shared_ptr> subTreePtr, const ItemType target, bool& isSuccessful);
auto moveValuesUpTree(std::shared_ptr> subTreePtr);
virtual auto findNode(std::shared_ptr> subTreePtr, const ItemType& target, bool& isSuccessful) const;
auto copyTree(const std::shared_ptr> oldTreeRootPtr) const;
void destroyTree(std::shared_ptr> subTreePtr);
void preorder(void visit(ItemType&), std::shared_ptr> treePtr) const;
void inorder(void visit(ItemType&), std::shared_ptr> treePtr) const;
void postorder(void visit(ItemType&), std::shared_ptr> treePtr) const;
public:
BinaryNodeTree();
BinaryNodeTree(const ItemType& rootItem, const std::shared_ptr> leftTreePtr, const std::shared_ptr> rightTreePtr);
BinaryNodeTree(const std::shared_ptr>& tree);
virtual ~BinaryNodeTree();
bool isEmpty() const;
int getHeight() const;
int getNumberOfNodes() const;
ItemType getRootData() const throw(PrecondViolatedExcept);
void setRootData(const ItemType& newData);
bool add(const ItemType& newData);
bool remove(const ItemType& data);
void clear();
ItemType getEntry(const ItemType& anEntry) const throw(notFoundException);
bool contains(const ItemType& anEntry) const;
void preorderTraverse(void visit(ItemType&)) const;
void inorderTraverse(void visit(ItemType&)) const;
void postorderTraverse(void visit(ItemType&)) const;
BinaryNodeTree& operator=(const BinaryNodeTree& rightHandSide);
};
#include "BinaryNodeTree.cpp"
#endif

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!