Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ 5. (20 marks) Max heap implementation. A max heap is a data structure that supports at least three basic operations deleteMax and insert
In C++
5. (20 marks) Max heap implementation. A max heap is a data structure that supports at least three basic operations deleteMax and insert in O(logN), and findMax (returns the maximum element) in O(1). The structure is identical to a binary heap, but the heap order property is that for any node, X the element stored at X is larger than or equal to the elements stored in its two children a. Please implement MaxHeap class template in MaxHeap.h b. Please write an application program a4q5.cpp that contains main () function The main O function. 1), creates a max heap with MaxHeapint maxheap, 2). prompt user to enter a sequence of int values, and call insert member function to insert these values in maxheap one by one, 3). repeatedly print the maximal element by calling findMax function and remove the maximum by calling deleteMax until maxheap is emptyStep 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