Question: IN C++ CODING In this assignment, you are given several classes in the cpp file Heap.cpp. Your task is to complete the implementation of the

IN C++ CODING

IN C++ CODING In this assignment, you are given several classes in

In this assignment, you are given several classes in the cpp file "Heap.cpp". Your task is to complete the implementation of the classes specified as below. You need to submit a single cpp file that contains everything. 1 Your Task You are given a class "TNode" that contains one integer value, and three pointers one to the parent, one to the left child, and one to the right child. You need to complete the class "minHeap" and other functions specified in the cpp file. Task 1: Implement the constructors (default and copy) of Heap. You need to make sure that the copy constructor makes a separate copy of the heap. Task 2: Implement in, removemin, getmin. Note: .getmin returns the pointer to the min element, but do not modify the heap. On the other hand, removemin just deletes the min element from the heap. . In this homework, I request that the in function takes input "const TNode t", which means you cannot modify the input node t. You should create a new node (different from the input node t) and then add into the heap . It is highly recommended to write helper functions, such as bubble-up and bubble-down. If you don't know what they are, you should review heap. Task 3: Implement Heapify that takes input a binary tree, and makes a heap from the binary tree. Here your binary tree is in the array form. You cannot modify the array Task 4: Implement Heapsort that takes input an array of size n, and returns a sorted array. Task 5: Design a test function of your own design. Test everything

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!