Heap Data Structure

  • Last Updated : 27 Sep, 2023

DSA for Beginners
Learn more about Heap in DSA Self Paced Course
Practice Problems on Heap
Top Quizzes on Heap

What is Heap Data Structure?

A Heap is a special Tree-based data structure in which the tree is a complete binary tree.

Heap Data Structure

Heap Data Structure


Operations 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 Structure


Generally, Heaps can be of two types:

  1. 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.
  2. 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 :

Introduction:

  1. Introduction to Heap – Data Structure and Algorithm Tutorials
  2. Binary Heap
  3. Applications, Advantages and Disadvantages of Heap
  4. Time Complexity of building a heap
  5. Applications of Heap Data Structure
  6. Comparison between Heap and Tree
  7. When building a Heap, is the structure of Heap unique?

Some other types of Heap:

  1. Binomial Heap
  2. Fibonacci Heap
  3. Leftist Heap
  4. K-ary Heap

Standard problems on Heap:

Quick Links:

Recomended:


Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.