You will implement minimum heap using vector. The code template (hw4_B_template.cpp) is provided and the goal is
Question:
You will implement minimum heap using vector. The code template (hw4_B_template.cpp) is provided and the goal is to implement insertion and removal functions of minimum heap. Minimum Heap is a complete binary tree where the value of each node is less than (or equal) to the value of any of its child. The insert function should add each item to the heap (in our template the item is stored in a vector) and when doing so the function should maintain the vector as minimum heap. The remove function will delete the smallest element (which is the root element) from the heap and update the vector such that it remains as minimum heap after the deletion. You can add extra functions that you think are necessary to complete the goal. Below is an example to illustrate minimum heap insertion and removal. Suppose we want to insert the following items into the heap: 10 9 8 7 6 11 12 13 14 15