why we taking array from 0 ??
Build Heap from Array
indexing in computer program starts from 0
I was asking that indexing starts from 0 but in the video bhaiya always takes array from 1.
why ??
because the relations are easier to manage then
if we start from 0
then the relation b/w child node will be
if parent is i
then 2 * i + 1 and 2 * i + 2
if we start from i =0 then child nodes will be 2 * i , 2 * i + 1
soo
u can take it either ways
bhaiay would have felt comfortable this way
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.