### Timed Sort Mode

If you switch to the "Timed Sort" panel, you'll see a large message area, with some instructions. This panel is used to obtain statistics about the running times of various running algorithms. The interesting question is how the running time depends on the number of items being sorted. There is a text-input box at the top of the panel where you can specify the size of the array that is to be sorted. You can also specify the number of arrays to be sorted. The point is that a small array takes so little time to sort that the time cannot be measured accurately. So, you should sort a number of arrays, all of the same size. You can measure the total time it takes to sort them all. The time required to sort one array can be obtained by dividing the total time by the number of arrays. You probably want to adjust the number of arrays so that the total time is at least a couple of seconds.

Note: Your computer must have enough memory to store all the numbers you want to sort. (If you are running the applet at all, you probably have enough memory to work with at least one million items.) If you ask for more numbers than you have room for, you should just a message telling you that you don't have enough memory. However, most systems that I have tried this on have crashed. This is a bug. You are warned. Stick to a reasonable number of items.

At the bottom of the panel are a pop-up menu that you can use to choose the sort method and a "Go" button that you can click to start the sort. (This changes to "Abort" while a sort is in progress.)

When you begin a sort, the first thing the computer does is to fill up the arrays with random numbers. If there are a lot of numbers, this will take a noticeable amount of time. Then, the computer begins to sort. As the sorting operation proceeds, statistics are displayed about twice per second. The statistics include the number of comparison and copy operations that have been performed, the number of arrays that have been sorted so far, the elapsed time since the computer began sorting, and the approximate compute time that the computer has devoted to sorting. The compute time is not the same as the elapsed time, since the applet is doing other things besides sorting (such as redrawing the screen). The applet tries to use 80% of the time for sorting, and to leave 20% for other tasks. The applet can measure the 20% of its time that it gives away voluntarily, but if other things are going on in your computer, it might lose some other time that it can't measure. This is why the measured compute time is approximate. So, you should not try to run a timed sort in the background! Just sit and watch -- or go get a coffee.