Question: C + + , Visual Studio. I have these four errors which I ve been told need to be fixed in my BinarySearchTree classes. I

C++, Visual Studio. I have these four errors which Ive been told need to be fixed in my BinarySearchTree classes. Im not sure what to fix in my classes and would appreciate a practical fix with comments. Due to formatting issues the includes and template is missing. It includes iostream and uses template class ItemType. Due to formatting I couldn't include the whole class.
BinarySearchTree.cpp: #include "BinarySearchTree.h" #include "BinaryNodeTree.h" #include "BinaryNode.h" #include template auto BinarySearchTree::placeNode(std::shared_ptr> subTreePtr, std::shared_ptr> newNode)
{ if (subTreePtr == nullptr) return newNode; else { if (subTreePtr->getItem()> newNode->getItem()){ subTreePtr->setLeftChildPtr(placeNode(subTreePtr->getLeftChildPtr(), newNode)); } else { subTreePtr->setRightChildPtr(placeNode(subTreePtr->getRightChildPtr(), newNode)); } return subTreePtr; }} template
auto BinarySearchTree::removeValue(std::shared_ptr> subTreePtr, const ItemType target, bool& isSuccessful){ if (subTreePtr == nullptr){ isSuccessful = false; } else if (subTreePtr->getItem()== target){ subTreePtr = removeNode(subTreePtr); isSuccessful = true; } else if (subTreePtr->getItem()> target){ std::shared_ptr> tempPtr = removeValue(subTreePtr->getLeftChildPtr(), target, isSuccessful); subTreePtr->setLeftChildPtr(tempPtr); } else { std::shared_ptr> tempPtr = removeValue(subTreePtr->getRightChildPtr(), target, isSuccessful); subTreePtr->setRightChildPtr(tempPtr); } return subTreePtr; } template
bool BinarySearchTree::add(const ItemType& newData){ auto newNodePtr = std::make_shared>(newData); rootPtr = placeNode(rootPtr, newNodePtr); return true; } template auto BinarySearchTree::removeNode(std::shared_ptr> nodePtr){ if (nodePtr->getLeftChildPtr()== nullptr || nodePtr->getRightChildPtr()== nullptr)
{ nodePtr = nullptr; return nodePtr; } else if ((nodePtr->getLeftChildPtr()!= nullptr)!=(nodePtr->getRightChildPtr()!= nullptr)){ std::shared_ptr> nodeToConnectPtr = nullptr; if (nodePtr->getLeftChildPtr()!= nullptr){ nodeToConnectPtr = nodePtr->getLeftChildPtr(); } else { nodeToConnectPtr = nodePtr->getRightChildPtr(); } return nodeToConnectPtr; } else { auto tempPtr = removeLeftmostNode(nodePtr->getRightChildPtr(), nodePtr->getItem()); nodePtr->setRightChildPtr(tempPtr); nodePtr->setItem(nodePtr->getItem()); return nodePtr; }} template auto BinarySearchTree::removeLeftMostNode(std::shared_ptr> subTreePtr, ItemType& inorderSuccessor){ if (subTreePtr->getLeftChildPtr()== nullptr){ inorderSuccessor = subTreePtr->getItem(); return removeNode(subTreePtr); } else { auto tempPtr = removeLeftmostNode(subTreePtr->getLeftChildPtr(), inorderSuccessor); subTreePtr->setLeftChildPtr(tempPtr);return subTreePtr; }} template auto BinarySearchTree::findNode(std::shared_ptr> treePtr,
const ItemType& target, bool& isSuccessful){ if (treePtr == nullptr) return nullptr; else if (treePtr->getItem()== target){ isSuccessful = true; return treePtr; } else if (treePtr->getItem()> target) return findNode(treePtr->getLeftChildPtr(), target, isSuccessful); else return findNode(treePtr->getRightChildPtr(), target, isSuccessful); } template BinarySearchTree::BinarySearchTree(){} template BinarySearchTree::BinarySearchTree(const ItemType& rootItem) :rootPtr(std::make_shared>(rootItem, nullptr, nullptr)){} template BinarySearchTree::BinarySearchTree(const BinarySearchTree& tree){ rootPtr = this->copyTree(tree.rootPtr); } template BinarySearchTree::~BinarySearchTree(){ this->destroyTree(rootPtr); } template int BinarySearchTree::getHeight() const { return this->getHeightHelper(rootPtr); } template bool BinarySearchTree::isEmpty() const { return rootPtr == nullptr; } template int BinarySearchTree::getNumberOfNodes() const { return this->getNumberOfNodesHelper(rootPtr); } template void BinarySearchTree::clear(){ this->destroyTree(rootPtr); this->rootPtr.reset(); } template ItemType BinarySearchTree::getRootData() const throw(PrecondViolatedExcept){ if (isEmpty()) throw PrecondViolatedExcept("getRootData() called with empty tree."); return this->rootPtr->getItem(); } template void BinarySearchTree::setRootData(const ItemType& newData) const throw(PrecondViolatedExcept){ if (isEmpty()) this->rootPtr =
C + + , Visual Studio. I have these four errors

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!