Advanced Topics in Computer Science

Unit 7: Heaps and Heap Sort

Students study priority queues and the heap structure that supports efficient access to the highest or lowest priority item.

Unit Focus

What this unit is really teaching

This unit connects tree ideas to array-based implementation and prepares students for scheduling, graph algorithms, and heapsort.

Key Topics

  • +Complete binary trees and array representation
  • +Min-heaps, max-heaps, heap order, and structural invariants
  • +Insert, remove, peek, percolate up, and percolate down
  • +PriorityQueue use cases and custom comparators
  • +Heapify and heapsort
  • +Runtime comparison with sorted arrays, linked lists, and binary search trees

Practice Work

Implementation and analysis tasks

Student task

Implement a binary heap-backed priority queue.

Student task

Use a priority queue to simulate task scheduling or emergency triage.

Need support with Unit 7?

Work through the concepts, code, edge cases, and runtime analysis with 1:1 guidance.

Enroll Now