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 that will create a binary search tree with nodes of type.

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

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!