CS 114 B Project 2
Spring 1996

Due April 15 1996
A heap is a convenient way of keeping an array of items in a sequence, especially when items are constantly inserted and removed. Let us implement the heap class using an array. The subscripts of the array range between the constants Lower and Upper.

In the array the heap is stored in the form of a binary tree. Each node has two child nodes. The value of the node is always greater than its children. This property is called the heap property. The number of nodes in each level of the tree is always a power of two, except for the lowest level.

if Lower=0, the first item in the heap is stored in Heap[0], the second level is stored in Heap[1] and Heap[2], the third level is stored in Heap[3]....Heap[6], etc.

Post conditions of the Heap-Insert and Heap-Remove operations must be such that the heap property is maintained by reorganization of the Heap array. This operation of converting an existing array to conform to the heap property is called heapify.

Use your experience with creating classes for stacks and queues to implement the heap.
[Ref. stacks (Pg 187, Ford & Topp) and queues (Pg 206, Ford & Topp)]