Insertion heap doubt

Why have we initialized starting index with -1

Hello @anika203a there are different appraoches to the question.
could you please share the code and tell where you are asking so that i can tell you .

Here in line 23

Hello @anika203a this i think we are doing because we are pushing the actual things we are pushing -1.
because when we will pop last element then if we want to perform operations on it then we can do this by taking -1 as before 0th index -1 is there .
it is simple.
HAppy Learning!!

Okay… thank you !!

@anika203a if you feel that your doubt is cleared you can mark this doubt as resolved.
Happy 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.