Heap Data Structure Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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 Binary HeapApplications of Heap Data Structure Library ImplementationsHeap in C++ STLpriority_queue in C++PriorityQueue in Java PriorityQueue in C#heapq in PythonHeap in JavaScriptEasy Problems Check if an array is Heap? K’th Smallest & K'th LargestHeap Sort Heap Sort for Decreasing Order Height of a Heap with N Nodes Medium ProblemsNearly Sorted ArrayK Largest Elements & K Smallest k Closest Elements Max diff between two m Sized SubsetsCheck if Binary Tree is HeapHuffman CodingNodes 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 streamLargest triplet product in a streamk most frequent Min Heap to Max HeapCheck for Min-Heap from Level Order BST to Min Heap K Closest Points to the Origin Hard ProblemsThe Skyline Problem Median in a streamK-th Largest Sum Subarray Sort by Frequency Merge k sorted arrays & Linked Lists Range Covering K Sorted ListsPrim's Minimum Spanning TreeDijkstra's Shortest PathSort numbers stored on 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 Other Types of HeapsBinomial HeapFibonacci HeapLeftist HeapK-ary HeapQuick Links:Top Interview Questions on HeapPractice Problems on HeapQuizzes on Heap Learn Data Structure and Algorithms | DSA Tutorial Binary Heap Introduction Visit Course Binary Heap Introduction Heap Python Implementation (Introduction) Comment More info H harendrakumar123 Follow Improve Article Tags : Heap DSA Explore DSA FundamentalsLogic Building Problems 2 min read Analysis of Algorithms 1 min read Data StructuresArray Data Structure 3 min read String in Data Structure 2 min read Hashing in Data Structure 2 min read Linked List Data Structure 2 min read Stack Data Structure 2 min read Queue Data Structure 2 min read Tree Data Structure 2 min read Graph Data Structure 3 min read Trie Data Structure 15+ min read AlgorithmsSearching Algorithms 2 min read Sorting Algorithms 3 min read Introduction to Recursion 14 min read Greedy Algorithms 3 min read Graph Algorithms 3 min read Dynamic Programming or DP 3 min read Bitwise Algorithms 4 min read AdvancedSegment Tree 2 min read Binary Indexed Tree or Fenwick Tree 15 min read Square Root (Sqrt) Decomposition Algorithm 15+ min read Binary Lifting 15+ min read Geometry 2 min read Interview PreparationInterview Corner 3 min read GfG160 3 min read Practice ProblemGeeksforGeeks Practice - Leading Online Coding Platform 6 min read Problem of The Day - Develop the Habit of Coding 5 min read Like