Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago