suppose I want to delete 20, then according to me, if we swap 20 with the last element i.e. 7. And then, if we downheapify 7, then it must also produce the max heap. Is there any thing wrong in this approach?
Can't we use the previous concept here?
I left one thing, after swapping 20 with 7, I will pop out 20 and then I will downheapify the 7. It may produce the same results. So, I want to you to please elaborate - is anything wrong in this approach?