item to find
A comparator instance
array of indices of the item in the heap
Parent's index
Index of the left child
Index of the node
Parent's index
Parent's index
Index of the right child
Index of the node
Parent's index
Compare the parent with both of it's children and swap it with the appropriate child (smaller child for MinHeap and bigger child for MaxHeap). Do the same for next children after swap.
Index to start heapify process from
Take the last item (last in the container array or bottom left in the heap) and lift it up until its in the correct position with respect to its parent
Index to start heapify process from
MaxHeap: Parent must be greater than or equal to the child node MinHeap: Parent must be less than or equal to the child node
Parent Node
Child Node
Parent's index
Index of the node
Get the root node without modifying the heap
Remove the root node
Item to remove
A comparator Instance
Parent's index
Index of the first item
Index of the second item
Heap Data structure