A
max
heap is a complete binary tree where value of each node is greater than or equal to the values of its children
The
root
node of the tree is the node with the maximum value.
Max heaps are often used to
implement
priority queues where the element with the largest value is always at the root of the heap
Max heaps can be
implemented
as arrays.
The
children
of a node in a max heap implemented as an array are located at indices 2i+1 and 2i+2
Max heap operations such as insertion and removal can be performed in
logarithmic
time
The max heap property is
used
in the heap sort sorting algorithm and several other algorithms such as the selection algorithm
Everything about the min heap