Heap Data Structure
A heap is a complete binary tree satisfying the heap-order property. In a min-heap, every parent is less than or equal to its children, so the minimum element is at the root. In a max-heap, every parent is greater than or equal to its children, so the maximum is at the root. Heaps are commonly used to implement priority queues.
Heap is structurally a complete binary tree.
Min-heap exposes the minimum at the root.
Max-heap exposes the maximum at the root.
Insertion and deletion of the root take O(log n).
Peek at the root takes O(1).
Heaps are widely used in priority queues and scheduling.
0-2 years experience
2-5 years experience
5-8 years experience
8+ years experience