# Assignment 3

1. Write a procedure for Heap-Sort

2. Write the upward and downward build-heap algorithms for an arbi-

trary array of integers.

3. Write code for heapify, which assumes that the two subtrees rooted

at the children of a node are heaps, and extends the heap property to

include the node of reference.

4. Write a procedure to extract the minimum element from a min heap

and restore the heap property among the remaining elements.

5. Write a routine to add an extra element into an existing heap. This

should increase the heapsize by 1 and then incorporate the new ele-

ment.

6. Write a routine for restoring the heap property when the key value at

a node is altered.

7. Write code for finding the parent and child indices for a k-ary heap.

8. Write a program to build a treap from a given set of ordered pair

values.

9. Write a program to buils an alternating heap of n elements.

You'll get 1 file (21.6KB)