Introduction To
Heap Data Structure
Heap is a specialized tree-based data structure which is essentially an almost complete tree that satisfies the heap property. In a max heap, for any given node C, if P is a parent node of C, then the key (the value) of P is greater than or equal to the key of C. In a min heap, the key of P is less than or equal to the key of C. The node at the "top" of the heap (with no parents) is called the root node.
Heaps are usually implemented in an array (fixed size or dynamic array), and do not require pointers between elements. After an element is inserted into or deleted from a heap, the heap property may be violated and the heap must be balanced by internal operations.
Course Structure
Popular Articles on Heap
- Binary Heap
- Time Complexity of building a heap
- Applications of Heap Data Structure
- K-ary Heap
- HeapSort
- Iterative HeapSort
- K’th Smallest/Largest Element in Unsorted Array | Set 1
- Check if a given Binary Tree is Heap
- How to check if a given array represents a Binary Heap?
- Connect n ropes with minimum cost
- Merge k sorted arrays | Set 1
- Merge Sort Tree for Range Order Statistics
- Smallest Derangement of Sequence
- Largest Derangement of a Sequence
- K maximum sum combinations from two arrays
- Maximum distinct elements after removing k elements
- Maximum difference between two subsets of m elements
- Height of a complete binary tree (or Heap) with N nodes
- Heap Sort for decreasing order using min heap
- Print all nodes less than a value x in a Min Heap.
- Median of Stream of Running Integers using STL
- Largest triplet product in a stream
- Convert BST to Min Heap
- Merge two binary Max Heaps
- K-th Largest Sum Contiguous Subarray
- Minimum product of k integers in an array of positive Integers
- Leaf starting point in a Binary Heap data structure
- Convert min Heap to max Heap
- Given level order traversal of a Binary Tree, check if the Tree is a Min-Heap
- Rearrange characters in a string such that no two adjacent are same
- Implementation of Binomial Heap
- Array Representation Of Binary Heap
- Sum of all elements between k1’th and k2’th smallest elements
- Minimum sum of two numbers formed from digits of an array
- K’th largest element in a stream
- k largest(or smallest) elements in an array | added Min Heap method
- Median in a stream of integers (running integers)
- Sort a nearly sorted (or K sorted) array