...

/

Min Heap: An Introduction

Min Heap: An Introduction

This lesson will give a brief introduction about Min Heap, and how elements are inserted or removed from them.

Building a Min-Heap

A Min Heap follows the Min Heap property, which means the key at the parent node is always smaller than keys at both children nodes.

Heaps can be implemented using arrays. Initially, elements are placed in nodes in the same order as they appear in the array. Then a function is called over the whole Heap in a bottom-up manner, which “Min Heapifies” this Heap so that the Heap property is satisfied on all nodes.

When ...