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
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started