Grokking 75: Top Coding Interview Questions
Ask Author
Back to course home

0% completed

Vote For New Content

On this page

Two main types of heaps

Storing a Heap in an Array

Array Representation of a Heap

Example: Max Heap as an Array

Example: Min Heap as an Array

  1. Find Maximum/Minimum in a Heap
  1. Inserting Elements into a Heap (Heapify Up)

Step-by-step Algorithm for Inserting an Element

Step-by-Step Example (Min Heap Insertion)

Code

Complexity Analysis

  1. Deleting Elements from a Heap (Heapify Down)

Step-by-step Algorithm for Deleting the Root (Deletion in Min Heap)

Step-by-Step Example (Min Heap Deletion)

Code

Complexity Analysis

  1. Building a Heap from an Unordered Array

Algorithm for Building a Heap

Code

Complexity Analysis

Heap Implementation in Different Programming Languages