Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment 1 Create a class (BinaryTree) template that will create a binary tree

ID: 3771636 • Letter: A

Question

Assignment 1

Create a class (BinaryTree) template that will create a binary tree that can hold values of any data type. The class should provide functions to insert a node, a function to delete a node, functions to display the tree In Order, Pre Order and Post Order. It should also provide a member function to search the tree for a value. The class should provide a function that counts the number of nodes in the tree, a function to count the number leaf nodes in the tree, and a function that determines the height of the tree. The height of a tree is the number of levels the tree has. Write a program that shows all these functions work.

Assignment 2

In this program you are going to use the binary tree class you created in Assignment 1 this week. First create a class called EmployeeInfo that holds two private data members. One data member is an integer called empID which holds the id number of the employee. The second data member is a string called empName which holds the full name of the employee. The program will create an instance of the binary tree class with a data type of EmployeeInfo (BinaryTree<EmployeeInfo>). The binary tree will be sorted by the Employee ID number found in the EmployeeInfo class. The program should then allow the user to search for Employee by the Employee ID. If the employee is found in the tree, its name and ID should be displayed. If not, a message should be displayed indicating that it was not found. Sample data would be

1021       John Williams

1057       Bill Witherspoon

2487       Jennifer Twain

3769       Sophia Lancaster

1017       Debbie Reece

1275       George McMullen

1899       Ashley Smith

4218       Josh Plemmons

Explanation / Answer

Answer 1)The following program will create and then insert,delete a node and display the tree in order.it performs post order,inorder and pre -order.The various aspects and functions are written and called .

Answer 2) This program shows the creation of the employee class with empoyee id and employee name. After this we will use the constuctors and call them from main using both the classes.

/* MAIN */