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.
- Binary Heap
- Applications
- Heap in C++ STL
- priority_queue in C++
- PriorityQueue in Java
- PriorityQueue in C#
- heapq in Python
- Heap in JavaScript
- Check if an array is Heap?
- K’th Smallest & K’th Largest
- Heap Sort
- Heap Sort for Decreasing Order
- Height of a Heap with N Nodes
- Nearly Sorted Array
- K Largest Elements & K Smallest
- k Closest Elements
- Max diff between two m Sized Subsets
- Check if Binary Tree is Heap
- Huffman Coding
- Nodes less than a value in a Min Heap.
- Connect n ropes with minimum cost
- K maximum sum combinations from two arrays
- K’th largest in a stream
- Largest triplet product in a stream
- k most frequent
- Min Heap to Max Heap
- Check for Min-Heap from Level Order
- BST to Min Heap
- K Closest Points to the Origin
- The Skyline Problem
- Median in a stream
- K-th Largest Sum Subarray
- Sort by Frequency
- Merge k sorted arrays & Linked Lists
- Range Covering K Sorted Lists
- Prim’s Minimum Spanning Tree
- Dijkstra’s Shortest Path
- Sort from different machines
- Largest Derangement of a Sequence
- Merge two binary Max Heaps
- Sum of all between k1’th and k2’th smallest
- A data structure with min and max
- Binomial Heap
- Fibonacci Heap
- Leftist Heap
- K-ary Heap
Quick Links:
- Interview Questions on Heap
- Practice Problems on Heap
- Quiz on Heap
- DSA Tutorial