CS 412/413
Introduction to Compilers
Spring 2001


Implements an in-place heap sort function that takes arguments (N, A), where N is the number of elements in the array A, starting from index 1. The heapsort algorithm is from Numerical Recipes in C, section 9.2, pg 247. The values that are sorted are randomly generated integers.  This tests the efficiency of your array bounds checking and null array checking, since a large number of array accesses are made.  It also tests your compiler's ability to generate IR and perform dataflow analysis on the heapsort function, which has fairly complicated control flow.

Source: [heapsort.im heapsort.cpp Heapsort.java]
The first pair of elements that is not in sorted order, or if the sort is correct, the last element in the array.

C++ 1.55
Java 2.6
B 3.13
C 3.54
D 3.61
G 3.72
E 4.76
A 6.79
H 14.31