The first phase of the assignment comprises solution using at least one working implementation; the final deliverable includes all three implementations and complexity experiments.
Notes:
#include#include /* .... all the other procedures */ int main(int argc, char **argv) { int A[MAX]; int i; struct timeval tp1, tp2; float time_taken; /* setup */ setup(A); /* sort it */ gettimeofday(&tp1, NULL); printf("tp1.tv_sec = %ld, usec = %ld\n", tp1.tv_sec,tp1.tv_usec); qsort(A, 0, 9); gettimeofday(&tp2, NULL); printf("tp2.tv_sec = %ld, usec = %ld\n", tp2.tv_sec,tp2.tv_usec); /* print results */ for(i=0; i<MAX; i++) printf("A[%d] = %d\n", i, A[i]); time_taken = (tp2.tv_sec - tp1.tv_sec) + (tp2.tv_usec - tp1.tv_usec) * 1e-6; printf("Time taken (wall clock) = %f secs\n", time_taken); } /* EOF */