308-203A Introduction to Computing II Lecture 10: Heaps

10/23/00


Click here to start


Table of Contents

308-203A Introduction to Computing II Lecture 10: Heaps

Motivation

Heap

How could we do this?

Arrays as Binary Trees

Example (as array)

Example (as tree)

Facts

The Heap Property

Example

Heap-Insert

Heap-Insert: Example

Heap-Insert: Example

Heap-Insert: Example

Helper routine: Heapify

Heapify

Heapify: example

Heapify: example

Heapify: example

Heapify: example

Heap-Extract-Max

Heap-Extract-Max: example

Heap-Extract-Max: example

Heap-Extract-Max: example

Order of Growth

Other useful operations

Build-Heap

Heap-Sort

Any questions?

Author: Alfred Holz

Email: wrenne@acm.org

Home Page: http://www.cs.mcgill.ca/~cs203