C++ problem Part 1: Building Your Binary Search Tree Using the header file provided in class, create

C++ problem

Part 1: Building Your Binary Search Tree

Using the header file provided in class, create a templated Binary Search Tree data structure.

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

Your Binary Search Tree class must contain the following public constructors and destructors:

Default constructor

Copy constructor

Destructor

Your Binary Search Tree class must contain the following access functions:

bstitem minimum();
//finds the minimum value in the Binary Search Tree and returns it
//pre: !isEmpty()
bstitem maximum();
//finds the maximum value in the Binary Search Tree and returns it

//pre: !isEmpty()

bool isEmpty();
//returns whether the tree is empty
int getSize();
//returns the size of the tree
bstitem getRoot();
//returns the value stored at the root of the tree

//Pre: !isEmpty()

int getHeight();
//recursively finds the height of the tree and returns it

//Pre: !isEmpty()

bool find(bstitem value);
//returns whether the value is in the tree

//Pre: !isEmpty()

Your BST class must contain the following manipulation procedures:

void insert(bstitem value);
//adds the specified value to the tree
void remove(bstitem value);
//removes the specified value from the tree

//Pre: !isEmpty()

//Pre: The value is contained in the Binary Search Tree

//If the value is not in the Binary Search Tree, the tree is left unchanged

Your Binary Search Tree class must contain the following additional functions:

void inOrderPrint();
// recursively prints the values contained in the Binary Search Tree
// according to an in order traversal
void preOrderPrint();
//recursively prints the values contained in the Binary Search Tree
// according to a pre order traversal
void postOrderPrint();
//recursively prints the values contained in the Binary Search Tree
// according to a post order traversal

In addition, your Binary Search Tree must contain a number of private helper functions, as described in class, wherever necessary for the recursive implementation of the above public functions.

Important: These helper functions must always be named according to the algorithm + Helper

For example: The helper function for the wrapper function find must be named findHelper

All of these functions and their definitions must be located inside of a file named BinarySearchTree.h

The prototypes for the helper functions must be contained inside the class definition under private

However, the private helper functions must be implemented below the class definition, along with the rest of the functions.

Finally, you must have a file named BinarySearchTreeTest.cpp in which you thoroughly test each of these functions, including their edge cases.

A Word on the Copy Constructor and Destructor

You will need to use helper functions for your copy constructor and destructor.

These helper functions will employ similar approaches to two of the tree traversals that we have studied.

It is up to you to figure out which tree traversal would work best for the copy constructor and which tree traversal would work best for the destructor.

Note that you should be sure to test your code using Eclipse GCC, or you might get errors or different results due to the difference in compilers.

 

Looking for a Similar Assignment? Let us take care of your classwork while you enjoy your free time! All papers are written from scratch and are 100% Original. Try us today! Use Code FREE15