Question: PLEASE USE THE SAME FORMAT THAT IS POSTED to Complete the program BST with all the implementations in tree.h, and treeNode.h. In tree.h add a

PLEASE USE THE SAME FORMAT THAT IS POSTED to Complete the program BST with all the implementations in tree.h, and treeNode.h. In tree.h add a node and search for a specific item see the template below.

If is not the same format please don't post something totally diffrent.

=============================================================== TreeNode.h #ifndef TREE_NODE_H #define TREE_NODE_H

template class TreeNode { public: void setLeft(TreeNode *newLeft) {

}

TreeNode* getLeft() {

}

TreeNode* getRight() {

}

void setRight(TreeNode* newRight) {

}

void setData(T* newData) {

}

T* getData() {

}

private: TreeNode* left; TreeNode* right; T *data; };

#endif

================================================================Tree.h #ifndef TREE_H #define TREE_H

#include "TreeNode.h"

template class Tree { public: Tree() { root = NULL; }

void add(TreeNode* nodeToAdd) {

}

TreeNode* search(TreeNode* currentNode, const T data) { }

TreeNode* getRoot() { return root; }

private: TreeNode* root; };

#endif

=================================================================== main.cpp #include "Tree.h" #include

int main() { Tree intTree; TreeNode x; x.setData(new int(5)); intTree.add(&x); TreeNode y; y.setData(new int(10)); intTree.add(&x); intTree.add(&y); TreeNode found = intTree.search(intTree.getRoot(), 5);

}

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!