Please answer this doubt

Cant we do it using recursion like we do all the questions using recursion in binary tree taking pointer of left and right subtree,in heap why are we not doing like binary tree,ie,by forming a tree…

@garganshul151
You can do it with recursion also
But there is no need for recursion since you can simply do it by iteration
Recursion takes stack memory and is also more time consuming than iteration
So iteration here was the obvious choice
But if you want you can still use recursion to implement it for your learning

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.