Lecture 6

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. Lectures 6-9 slides.
  2. Review heaps from Data Structures course (See CLR: Section 6.1 - 6.3)
  3. CLR: Sections 6.4 - 6.5.
  4. CLR: Section 7.3.

Exercises and review questions


Last modified: 10 Sep 2015