The logic of deleting any node

please help me with the moving the node to be deleted to the root node by taking it to be infinity

According to the property of the heap, you can only pop elements from the top.
If you want to pop any element which is not the top element, you cannot do it directly. You would have to bring that element to the top and then pop the top element. Considering a max heap, this can be done by changing the element to be deleted to infinity. By max heap property, the heap will heapify and ultimately infinity will come at the top. Now you can follow the normal deletion procedure as taught in the course to remove infinity.

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.