Plz solve this doubt

I donot understand the difference in the insertion technique of this one and previous one…plz tell.

@garganshul151 hey,in unoptimise one ,we are using upheapify ans assuming that starting from first index of array heap is forming on one by one insertion of elements ,but in this case complexity will be more as you will more work with more no of nodes,so in another optimise approach you have taken elements from back and do downheapify in that case so starting from bacj we are making heap and doing less work with more no of nodes ,hence complexity is decreased to O(n).

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.