Assignment 2
Due on Thursday 1st March.
Write a program that sorts an array of numbers into ascending order. I don't care which of the many sorting algorithms you
use. You program should work well for any amount of data in the array. Once you have got the program working, make it
time itself (see the class handout for the timing functions) and work out the realtionship between amount of data
and time required to sort it. The realtionship should be a formula that calculates the (approximate) time, given
the data size. To find this relationship, you will need to do a number of experiments sorting fairly large arrays.
You do not want to type 1000 data items for your program to sort, so remember to use the random number generator (see class
handout) to automtically generate the data for sorting. Remember also that you share this computer with a lot of other
people. Don't over do the data size.
You should turn in for grading the program you wrote (including the timing and data generation code). Include the
formula that you work out, together with the raw data you worked it out from, as a comment in the program.