CS320 PA1


Here is a python skeleton code exPQ.py, which reads numbers eg from file in.

The skeleton code contains empty functions heapify, buildHeap, heapExtract, and heapInsert, that you need to implement. Notice that you need to implement a MIN HEAP.

You must implement the functions, such that their algorithmic complexity is preserved, e.g. heapExtract should take O(log n) time.


Given the input file "in" above, your program should print:

min 1
min 0
min 2

Submit your program exPQ.py using checkin (see assignments page):
~cs320/bin/checkin PA1 exPQ.py

Copyright © Colorado State University. All rights reserved.