CSCI 260 Fall 2022: Lab 5: Heaps



This lab is not for submission. It is for practice.

Write a file called heap.cpp. You can use the file provided in git repository Lab5 to define your heap class. Compile it using the command

g++ heap.cpp

The heap implemented will allow you to insert elements, extract the minimum value element, delete the minimum value element, print the heap and quit.
You are to implement MakeHeap so that it works efficiently to make a heap from a sequence of values. The code should heapify downwards all elements that are not leaves -- note that elements of index approximately heap.size()/2 or less have children. You should determine a correct index to start at.

You do not have to submit any files for this lab; it is to prepare you for the lab test next week. In the lab test, you will be provided with some heap code and a coding task.