Question: CSE 310 MAX HEAP CSE310 Project 1: Priority Queue, File IO, Modular Design Posted: Tuesday, 09/25/2018, Due: Tuesday, 10/16/2018 This is a programming project, to
CSE 310 MAX HEAP



CSE310 Project 1: Priority Queue, File IO, Modular Design Posted: Tuesday, 09/25/2018, Due: Tuesday, 10/16/2018 This is a programming project, to be completed and graded on general.asu.edu, a Linux machine. You will perform modular design, provide a Makefile to compile various modules to generate the executable file named run. You need to have a module that provide the services including command line interpretation. You need to have a module that implement the max-heap data structure. You should use the C++ programming language, not any other programming language. Also your program should be based on the g++ compiler on general.asu.edu. All programs will be compiled and graded on general.asu.edu, a Linux based machine. You will need to submit it electronically at the blackboard, in one zip file, named CSE310-P01-Lname-Fname, where Lname is your last name and Fname is your first name. The zip file should contain a set of files that are absolutely necessary to compile and execute your program. If you program does not compile and work on general.asu.edu, you will receive 0 on this project 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 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[i], i-1, 2, , n) and uses the linear time build 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. CSE310 Project 1: Priority Queue, File IO, Modular Design Posted: Tuesday, 09/25/2018, Due: Tuesday, 10/16/2018 This is a programming project, to be completed and graded on general.asu.edu, a Linux machine. You will perform modular design, provide a Makefile to compile various modules to generate the executable file named run. You need to have a module that provide the services including command line interpretation. You need to have a module that implement the max-heap data structure. You should use the C++ programming language, not any other programming language. Also your program should be based on the g++ compiler on general.asu.edu. All programs will be compiled and graded on general.asu.edu, a Linux based machine. You will need to submit it electronically at the blackboard, in one zip file, named CSE310-P01-Lname-Fname, where Lname is your last name and Fname is your first name. The zip file should contain a set of files that are absolutely necessary to compile and execute your program. If you program does not compile and work on general.asu.edu, you will receive 0 on this project 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 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[i], i-1, 2, , n) and uses the linear time build 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
