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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started