Question: Write a program to implement the min heap. Your insert method will insert the value in the correct place and display the vale of parent
Write a program to implement the min heap. Your insert method will insert the value in the correct place and display the vale of parent node, value of left child and value of right child. The remove method will remove the root and display its value which is the min value.
Test your program on the following:
minHeap.insert(5);
minHeap.insert(3);
minHeap.insert(17);
minHeap.insert(10);
minHeap.insert(84);
minHeap.insert(19);
minHeap.insert(6);
minHeap.insert(22);
minHeap.insert(9);
minHeap.remove());
Remember that: In a Min Binary Heap, the key at root must be minimum among all keys present in Binary Heap.
Need answer in Java Class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
