Heap Data Structure is generally taught with Heapsort. Heapsort algorithm has limited uses because Quicksort is better in practice. Nevertheless, the Heap data structure itself is enormously used. Following are some uses other than Heapsort.
Priority Queues: Priority queues can be efficiently implemented using Binary Heap because it supports insert(), delete() and extractmax(), decreaseKey() operations in O(logn) time. Binomoial Heap and Fibonacci Heap are variations of Binary Heap. These variations perform union also in O(logn) time which is a O(n) operation in Binary Heap. Heap Implemented priority queues are used in Graph algorithms like Prim’s Algorithm and Dijkstra’s algorithm.
Order statistics: The Heap data structure can be used to efficiently find the kth smallest (or largest) element in an array. See method 4 and 6 of this post for details.
References:
http://net.pku.edu.cn/~course/cs101/2007/resource/Intro2Algorithm/book6/chap07.htm
http://en.wikipedia.org/wiki/Heap_%28data_structure%29
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- Difference between Binary Heap, Binomial Heap and Fibonacci Heap
- Leaf starting point in a Binary Heap data structure
- Convert min Heap to max Heap
- Heap Sort for decreasing order using min heap
- Difference between Min Heap and Max Heap
- Overview of Data Structures | Set 2 (Binary Tree, BST, Heap and Hash)
- Applications of Priority Queue
- Design an efficient data structure for given operations
- Tournament Tree (Winner Tree) and Binary Heap
- Time Complexity of building a heap
- Why is Binary Heap Preferred over BST for Priority Queue?
- Fibonacci Heap | Set 1 (Introduction)
- Check if a given Binary Tree is Heap
- K-ary Heap
- Heap in C++ STL | make_heap(), push_heap(), pop_heap(), sort_heap(), is_heap, is_heap_until()
- Implementation of Binomial Heap
- Where is Heap Sort used practically?
- Binary Heap
- Array Representation Of Binary Heap
- Given level order traversal of a Binary Tree, check if the Tree is a Min-Heap

