why we are putting poped element back in heap?
Why we are putting poped element back in heap?
@pankajsingh we are not putting the popped element back in the heap we are creating a new element using both the popped element and we are putting that in the heap.
Suppose we pop 3, 4 adding them new rope will be 7 now as our aim is to create one big rope we will put 7 back(as their still might be other fragments in the heap left to be joined), and again repeat the process, we will stop when we cannot pop 2 elements from the heap.
If this reslves your doubt mark it resolved.
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.