Heap Data Structure
Last Updated :
05 Nov, 2024
Improve
A Heap is a complete binary tree data structure that satisfies the heap property: for every node, the value of its children is greater than or equal to its own value. Heaps are usually used to implement priority queues, where the smallest (or largest) element is always at the root of the tree.
Basics of Heap Data Structure
Library Implementations of Heap
Easy Problems on Heap Data Structure
- Heap Sort
- Check if a given Binary Tree is Heap
- Check if an array is a Binary Heap?
- Iterative Heap Sort
- K’th Largest Element in an array
- Height of a complete binary tree (or Heap) with N nodes
- Heap Sort for decreasing order using min heap
Medium Problems on Heap Data Structure
- Sort an almost sorted array
- K Largest Elements
- K’th Smallest/Largest Element in Unsorted Array
- Huffman Coding
- Nodes less than a value in a Min Heap.
- Tournament Tree (Winner Tree) and Binary Heap
- Connect n ropes with minimum cost
- Maximum distincts after removing k elements
- K maximum sum combinations from two arrays
- Median in a stream
- K’th largest in a stream
- Largest triplet product in a stream
- k most frequent numbers in an array
- Convert min Heap to max Heap
- Check for Min-Heap from Level Order
Hard Problems on Heap Data Structure
- Design an efficient data structure for given operations
- Merge k sorted arrays
- Merge K Sorted Linked Lists
- Prim's Minimum Spanning Tree
- Dijkstra's Shortest Path
- Sort numbers stored on different machines
- Smallest Derangement of Sequence
- Largest Derangement of a Sequence
- Maximum difference between two subsets of m elements
- Convert BST to Min Heap
- Merge two binary Max Heaps
- K-th Largest Sum Contiguous Subarray
- Minimum product of k integers
- Leaf starting point in a Binary Heap data structure
- Rearrange characters in a string such that no two adjacent are same
- Sum of all elements between k1’th and k2’th smallest elements
- Minimum sum of two numbers formed from digits of an array
Other Types of Heap Data Structure
Quick Links:
Recommended:


