Question: create a tree program with a treeNode.h, Tree.h, and main.cpp, implement both .h files. adding a node and searching functions. in the tree.h ====================================== TreeNode.h
create a tree program with a treeNode.h, Tree.h, and main.cpp, implement both .h files. adding a node and searching functions. in the tree.h
====================================== TreeNode.h
#ifndef TREE_NODE_H #define TREE_NODE_H
template
class TreeNode { public: //Sets the left node of the TreeNode to the given new node void * setLeft(TreeNode
TreeNode
//Sets the right node link of the TreeNode to the given new node. void * setRight(TreeNode
TreeNode
//Sets the data in the node to the given data. void setData(T*newData) { this data = newData; }
T *getData() { return this.data; }
private:
TreeNode
}; #endif;
===============================================tree.h
#ifndef TREE_H #define TREE_H
#include "TreeNode.h" template
class Tree { public: Tree() { root = NULL; }
void add(TreeNode
{
}
TreeNode
}
TreeNode
}; #endif;
========================================================== main.cpp
#include "Tree.h" #include
int main() { Tree
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
