Question: I needed help with this program written in C++. I know it's a large program but I'm running into many errors in C++ considering I
I needed help with this program written in C++.
I know it's a large program but I'm running into many errors in C++ considering I jumped I'm only learned the language by trial and error. so if anybody can help with this program that would be cool. *************but if it's too big to solve on here, can I at least get help on the BuildHeap() function? how to allocate copy an array of element information onto this already-made Heap's information***********************


I would greatly appreciate the time
You need to define the following data types . ELEMENT is a data type that contains a field named key, which is of type int. Note that ELEMENT should not be of type int. . HEAP is a data type that contains three fields named capacity (of type int), size (of type int), and H (an array of type ELEMENT with index ranging from 0 to capacity The functions that you are required to implement are Initialize(n) which returns an object of type HEAP with capacity n and size 0. This function requires you to perform dynamic memory allocation. o printHeap(heap) which prints out the heap information, including capacity, size, and the key fields of the elements in the array with index going from 1 to heap->size. . BuildHeap(heap, A, n, flag), where heap is a HEAP object, A is an array of type ELEMENT, n is an int which represents the size of array A, and flag is an int. This function copies the elements in A into heap->H (such that H [i]-A [1] , 1-1, 2, heap algorithm to obtain a max-heap of size n from the given array A. If flag-1, this function prints out the content of the the resulting heap. If flag-2, this function prints out the content of the the array heap->H after each outer call to heapify. If flag-0, this function does not do any printing , n) and uses the linear time build
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
