Previous Lecture Lecture 15 Next Lecture

Lecture 15, Thu 05/31

Heaps

Heaps

A Heap is a complete binary tree

MaxHeap

MinHeap

Examples

MaxHeap

MinHeap

Heaps are an efficient way to implement a Priority Queue

Heaps represented as an array

Heap Array

Insertion into a binary MaxHeap

Max Heap Insertion

Removing root element of a MaxHeap

Extract Root