Write a program to construct two heaps, with one min-heap(h1) and other with max-heap(h2). Then
combine them to form a new max-heap(h) in O(n), where n is the total number of elements.
Can you explain the algorithm
hello @sch
what issue u r facing in this?
for building max/min heap use one vector and then then use hepify to convert it in heap.
for mergring put content of max heap and min heap inside new vector and then use hepify to make it heap
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.