So far I've presented you with three different sorting methods, and also demonstration programs in basic. Now it's time to see how the different routines compare against one another. The most obvious way of comparing performances is by measuring the time each routine takes to sort a group of numbers. As the size of the group of numbers to be sorted varies, different sorting methods become more effective. The basic program ( B.COMPARE ) tests all three of the sorts so far encountered against each other for different group sizes. To run it PAGE should be set to &1200, if it is not the program automatically reloads to the correct address. Once running, you will be prompted for firstly the maximun group size to be sorted between two and ten. This represents the maximum power of 2^n that is sorted. If you don't understand this at first, just enter 6 or 7 or play with it and it'll become obvious, I hope.
Next you must enter how many times that the program is sort groups of data. The more times that the program is run, the more statistically accurate the results will be, just enter two or three if unsure. After that the program will switch to mode 0 and the results will be displayed and updated as they are calculated. Minimum, average, and maximum time taken to sort are given for each of the three sort routines, and for each size of group sorted up to the one selected.
It takes about 72 minutes to bubble sort 1024 numbers so be prepared to wait if you choose a large sort size!
Well because I'm already behind in getting this to Duncan, I've decided to spilt this article into two parts. You've just reached the end of the first half. The next half, covering all the rest that I've promised will probably appear next month if there's room. It'll give you a chance to work out and understand the first half. The second half gets complicated, believe me, I'm the one who has to write it.