COP 4531: Lecture 8

Learning objectives

After this class, you should be able to:

  1. Given an array, show how HEAPSORT will sort it, by showing the state of the heap after each step, using both array and pointer representations. You should be able to show the steps taken by the BUILD-MAX-HEAP function too.
  2. Analyze the time complexity of HEAPSORT. You should be able to analyze the time complexity of BUILD-MAX-HEAP too.
  3. Prove the correctness of HEAPSORT, and other operations on heaps, using loop invariants.
  4. Given a heap, show how each of the following operations execute, by showing the state of the heap after each step: (i) HEAP-EXTRACT-MAX, (ii) HEAP-INCREASE-KEY, and (iii) MAX-HEAP-INSERT.

Reading assignment

  1. CLR: Sections 6.4 - 6.5.
  2. CLR: Chapter 7, pages 146 - 147.

Exercises and review questions


Last modified: 7 Feb 2007