Heap Data StructureLast Updated : 27 Sep, 2023ReadDiscussCoursesDSA for BeginnersLearn more about Heap in DSA Self Paced CoursePractice Problems on HeapTop Quizzes on HeapWhat is Heap Data Structure?A Heap is a special Tree-based data structure in which the tree is a complete binary tree.Heap Data StructureOperations of Heap Data Structure:Heapify: a process of creating a heap from an array.Insertion: process to insert an element in existing heap time complexity O(log N).Deletion: deleting the top element of the heap or the highest priority element, and then organizing the heap and returning the element with time complexity O(log N).Peek: to check or find the first (or can say the top) element of the heap.Types of Heap Data StructureGenerally, Heaps can be of two types:Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of it’s children. The same property must be recursively true for all sub-trees in that Binary Tree.Min-Heap: In a Min-Heap the key present at the root node must be minimum among the keys present at all of it’s children. The same property must be recursively true for all sub-trees in that Binary Tree.Topics :IntroductionSome other types of HeapsStandard problems on heapQuick LinksIntroduction:Introduction to Heap – Data Structure and Algorithm TutorialsBinary HeapApplications, Advantages and Disadvantages of HeapTime Complexity of building a heapApplications of Heap Data StructureComparison between Heap and TreeWhen building a Heap, is the structure of Heap unique?Some other types of Heap:Binomial HeapFibonacci HeapLeftist HeapK-ary HeapStandard problems on Heap:Easy:Heap SortCheck if a given Binary Tree is HeapHow to check if a given array represents a Binary Heap?Iterative Heap SortK’th Largest Element in an arrayK’th Smallest/Largest Element in Unsorted Array | Set 1Height of a complete binary tree (or Heap) with N nodesHeap Sort for decreasing order using min heapMedium:Sort an almost sorted arrayPrint all nodes less than a value x in a Min Heap.Tournament Tree (Winner Tree) and Binary HeapConnect n ropes with minimum costMaximum distinct elements after removing k elementsK maximum sum combinations from two arraysMedian of Stream of Running Integers using STLMedian in a stream of integers (running integers)K’th largest element in a streamLargest triplet product in a streamFind k numbers with most occurrences in the given arrayConvert min Heap to max HeapGiven level order traversal of a Binary Tree, check if the Tree is a Min-HeapHard:Design an efficient data structure for given operationsMerge k sorted arrays | Set 1Sort numbers stored on different machinesSmallest Derangement of SequenceLargest Derangement of a SequenceMaximum difference between two subsets of m elementsConvert BST to Min HeapMerge two binary Max HeapsK-th Largest Sum Contiguous SubarrayMinimum product of k integers in an array of positive IntegersLeaf starting point in a Binary Heap data structureRearrange characters in a string such that no two adjacent are sameSum of all elements between k1’th and k2’th smallest elementsMinimum sum of two numbers formed from digits of an arrayQuick Links:Practice Problems on HeapQuizzes on HeapRecomended:Learn Data Structure and Algorithms | DSA TutorialPlease write comments if you find anything incorrect, or you want to share more information about the topic discussed above.