Assignment title: Information


•In this programming assignment you are asked to implement five new methods of the Binary Tree ADT developed in class. Use recursion when it is possible. The new methods are: SumLeaves, NumberOfOdd, MultipleOf, Clone, and DeleteSubtree. The specifications of these methods are provided below:  int SumLeftLeaves( ) - Function: returns the sum of all the left leaves' info. - Precondition: Tree has been initialized. - Postcondition: Function value = sum value of all left leaves' info.  int NumberOfOdd() - Function: Returns the number of odd elements that exist in the tree. - Precondition: Tree has been initialized - Postcondition: Function value = 0 if no odd element exist in the tree, else it returns the number of odd elements existing in the tree.  bool MultipleOf(int item) - Function: Checks if the elements stored in the tree are multiple of item. - Precondition: Tree and Item have been initialized - Postcondition: Function value = TRUE if all items of the tree are multiple of item; FALS E otherwise.  BinaryTree SymmetricClone () - Function: creates a new tree symmetric to the current instance. - Precondition: Tree has been initialized - Postcondition: Function value = a new tree is created that contains elements of the tree with left subtree becoming a right subtree and vice-versa.  void DeleteSubtree(int el) - Function: deletes the subtree having el as a root. - Precondition: tree and el have been initialized - Postcondition: Function value = all nodes belonging to the subtree with root el are deleted from the tree First, double check that the program Assig4.cpp creates correctly the below three trees. BinaryTree tree1, tree2, tree3, tree4; tree2.SumLeftLeaves(); returns 10+15=25 tree3.SumLeftLeaves(); returns 60=60 tree1.numberOfOdd(); returns 6 tree2.numberOfOdd(); returns 3 tree3.numberOfOdd(); returns 0 tree1.multipleOf(3); returns FALSE tree2.multipleOf(5); returns TRUE tree3.multipleOf(10); returns TRUE tree4 = tree2.SymmetricClone(); tree4.Print(InOrder); displays 10, 20, 25, 15, 5, 30, 60, 10, tree2.deleteSubTree(20); tree2.Print(InOrder); displays 10, 5, 60, 10, 30, The givin code:: #include #include using namespace std; #include "BinaryTree.h" int main(int argc, char* argv[]) { BinaryTree tree1, tree2, tree3, tree4; BTNode *left, *right, *node, *root; //Creating the special tree1 as shown in the figure provided in the assignment tree1.insert(10); root = tree1.Root(); left = new BTNode(7); node = new BTNode(4, 0, left); left->parent = node; right = new BTNode(7); node = new BTNode(5, root, node, right); node->left->parent = node; right->parent = node; root->left = node; left = new BTNode(7); right = new BTNode(25); node = new BTNode(7, root, left, right); right->parent = node; root->right = node; //Creating the special tree2 as shown in the figure provided in the assignment tree2.insert(10); root = tree2.Root(); left = new BTNode(10); node = new BTNode(60, 0, left); left->parent = node; right = new BTNode(30); node = new BTNode(5, root, node, right); node->left->parent = node; right->parent = node; root->left = node; left = new BTNode(15); right = new BTNode(25); node = new BTNode(20, root, left, right); right->parent = node; root->right = node; //Creating the special tree3 as shown in the figure provided in the assignment tree3.insert(10); root = tree3.Root(); left = new BTNode(60); node = new BTNode(40, 0, left); left->parent = node; node = new BTNode(20, root, node); node->left->parent = node; root->left = node; right = new BTNode(50); node = new BTNode(30, root, 0, right); right->parent = node; root->right = node; cout<<"Tree1 : "; tree1.Print(InOrder); cout<<"Tree2 : "; tree2.Print(InOrder); cout<<"Tree3 : "; tree3.Print(InOrder); system("PAUSE"); return 0; } ****************************************************************************************************** write the program using C++ visual studio 2013 + versions i need the full file the header and the cpp files and any other files used make sure that i can run it in any project. Q1. Use the spreadsheet template in Table 7.9 to simulate a customer service desk with two servers. The start time of the process is 9:00 AM (cell C4), and the inter-arrival times (cells B5 to B14) are given in minutes. Assume that the process consists of a single queue operating under a first-in-first-out discipline. That is, customers join the queue and move to the first available customer service representative in the order in which they arrived. Calculate the average waiting time and the utilization of each server. Q2. The chief of staff in the emergency room of Exercise is considering the computerization of the admissions process. This change will not reduce the 10 min service time, but it wills male it constant. Develop a spreadsheet simulation to compare the performance of the proposed automated process with the performance of the manual existing process. Hint: Note that inter arrival and service times that follow an exponential distribution can be generated with the Excel functions RAND() and LN() and the following expressions: Aj = -(1/?)xLN(RAND()) Sj = -(1/µ)xLN(RAND()) where µ is the mean service rate ? is the mean arrival rate The Excel formula RAND() generates a random number between 0 and 1. The natural logarithm of the random number is found to transform this number into an exponentially distributed value. The transformation to an exponential distribution is completed when the value is divided by the appropriated mean rate and the negative sign applied. (Simulate 500 patient is each case.) Q3. At Letchworth Community College, one person, the registrar, registers students for classes. Students arrive at a rate of 10/h (Poisson arrivals), and the registration process takes 5 min on the average (exponential distribution). The registrar is paid $5 per hour, and the cost of keeping students waiting is estimated to be $2 for each student for each hour waited (not including service time). Develop a process driven spreadsheet simulation to compare the estimated hourly cost of the following three systems. a. The current system. b. A computerized system that results in a service time of exactly 4 min. The computer leasing cost is $7 per hour. c. Hiring a more efficient registrar. Service time could be reduced to an average of 3 min (exponentially distributed), and the new registrar would be paid $5 per hour.