Minheap - insert is off

In the insert, there is a conditional to check if elements > heap.length; The else portion (which happens as we don’t readjust the size of the array after elements are pushed) has this.__percolateUp(this.heap.length - 1); It should be this.__percolateUp(this.elements - 1.

Hi Alexander ,

This is Ammar from Educative.

You are absolutely correct about this issue and it has been fixed in all the lessons of this chapter now. Thank you so much for pointing it out! Your feedback is very valuable to us.

We hope Educative has inspired to further your learning, and please drop us a note if you have any other questions or concerns.

Best Regards,
Ammar | Developer Advocate