Question: Using C++ create a template class Tree that will create a binary search tree with nodes of type . Include the following three constructors: 1.
Using C++ create a template class Tree
Include the following three constructors:
1. a default constructor that returns a pointer to an empty tree
2. a constructor that accepts a constant parameter of type and returns a new tree with one node
3. and a constructor that accepts a parameter of Tree that returns a copy of the binary search tree passed to the constructor (this will be the copy constructor for the class).
The Tree class needs to include the following:
type find(type key) : find key in the tree.
void insert(ype key) : insert a new node into the tree, preserving the sorted property of the tree
void delete(type key) : delete an existing node from the tree, preserving the sorted property of the tree
void inorder() : print the tree with an inorder traversal
void postorder() : print with a postorder traversal
void preorder() : print with a preorder traversal
Along with Unit test scripts for the code and a UML diagram.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
