1 min readMay 10, 2020
Hi Ankur Singh
Good Implementation. In the ‘heapifyDown’ method, I think the less than, greater than signs should be opposite. i.e. the heapifyDown method in the implementation seems to be of MinHeap rather than MaxHeap. Please verify once.
I also have a small suggestion. Instead of using an array, if you use ArrayList the ensureCapacity part will be taken care of by the ArrayList. Not sure if you have intentionally used array to understand what goes behind the scenes