Question: How do I fix my retrieve functions? #include BSTree.h template BSTree ::BSTreeNode::BSTreeNode ( const DataType &nodeDataItem, BSTreeNode *leftPtr, BSTreeNode *rightPtr ) { } template <

How do I fix my retrieve functions?

#include "BSTree.h"

template

BSTree::BSTreeNode::BSTreeNode ( const DataType &nodeDataItem, BSTreeNode *leftPtr, BSTreeNode *rightPtr )

{

}

template < typename DataType, class KeyType >

BSTree::BSTree ()

{

root = NULL;

}

template < typename DataType, class KeyType >

BSTree::BSTree ( const BSTree& other )

{

*this = other;

}

template < typename DataType, class KeyType >

BSTree& BSTree:: operator= ( const BSTree& other )

{

if (*this == &other)

return *this;

clear();

copyHelper(root, other.root);

return *this;

}

template < typename DataType, class KeyType >

BSTree::~BSTree ()

{

clear();

}

template < typename DataType, class KeyType >

void BSTree::insert ( const DataType& newDataItem )

{

KeyType key = newDataItem.getKey();

}

template < typename DataType, class KeyType >

bool BSTree::retrieve ( const KeyType& searchKey, DataType& searchDataItem ) const

{

return retrieve_sub(searchKey, searchDataItem, root);

}

template < typename DataType, class KeyType >

bool BSTree::remove ( const KeyType& deleteKey )

{

return removeHelper(root, deleteKey);

}

template < typename DataType, class KeyType >

void BSTree::writeKeys () const

{

writeKeysHelper(root);

cout << endl;

}

template < typename DataType, class KeyType >

void BSTree::clear ()

{

clearHelper(root);

}

template < typename DataType, class KeyType >

bool BSTree::isEmpty () const

{

return (root == NULL);

}

template < typename DataType, class KeyType >

int BSTree::getHeight () const

{

return getHeightHelper(root, 0);

}

template < typename DataType, class KeyType >

int BSTree::getCount () const

{

return getCountHelper(root);

}

template < typename DataType, class KeyType >

void BSTree::writeLessThan ( const KeyType& searchKey ) const

{

// variables

KeyType givenKey = searchKey;

bool keysAlreadyWritten = false;

// case: the tree is empty

if (root == NULL)

{

// report that tree is empty by printing whitespace

cout << endl;

}

// case: the tree has contents

else

{

// call the helper function

writeLessThan_sub(givenKey, root, NULL, keysAlreadyWritten);

// no keys printed yet

}

}

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 Databases Questions!