A min heap is a
complete
binary tree in which the value of each node is less than or equal to the values of its children.
The
root
node of the tree is the node with the minimum value.
Min heaps are often used to
implement
priority queues where the element with the smallest value is always at the root of the heap
The
children
of a node in a min heap implemented as an array are located at indices 2i+1 and 2i+2
Min heap
operations
such as insertion and removal can be performed in logarithmic time
A min heap can be
converted
to a sorted array by repeatedly removing the root node and placing it at the end of the array
The min heap property is used in several
algorithms
, such as Dijkstra's algorithm for finding shortest paths
Sorting in data structure