The buttons Search Animator, Sort Animator and Sort Timer can be used for this assignment. When you select these, you will be able to animate the behavior of many of the algorithms in Chapter 3, as well as empirically measure the efficiency of different sorting algorithms on different amounts of data.
For example, select Algorithm -> Selection Sort in the Sort
Animator and then select the Run button. You may Reset
and Rerun this exercise several times to get a feeling for how the
selection sort algorithm works.
To count the number of exchanges and comparisons in a particular selection
sort, you can repeatedly click the Step button and keep track of
the number of times steps 9 and 6 are repeated, respectively.
Now open the Sort Timer and select Algorithm -> Selection Sort and Points -> 128, and then select Run. Note that this gives the running time for selection-sorting 128 data points, and it graphically displays the behavior of the data being rearranged as the algorithm proceeds.
These animators and timers will be useful for answering some of the questions below.
Once you are finished in the lab, be sure to drag the csci105 icon to the Trash - this step disconnects you from the server and prevents someone else (who may use this iMac later in the day) from accidentally accessing files in your personal folder.
To submit a handwritten assignment, leave it in the CS105 mailbox near my office (Searles 220).
Note: Even though the lab programs for this course can be saved
and submitted electronically, you should always keep a backup copy of your
own work, so that if a file is lost you won't have to retype it from scratch.