depiction of the applet’s interface is shown in Figure
1 on the previous page.
In performing an experiment, the student selects
an algorithm, a data type, and a sample size from the
three JList objects located beneath their respective
labels. When a selection has been made, the student
clicks on the Select button in the panel at the right of
the screen, and an output string is appended to the
text area at the bottom-left (center) of the display.
The output indicates the algorithm selected, the type
of data set operated upon, the sample size chosen,
and the number of compares and swaps that were
counted during the run. The applet appends the
output string from each new selection to the contents
of the text area. The text area can be cleared at any
time by the student clicking on the Clear button at
the bottom of the panel at the right of the screen.
This panel also contains a small text area above the
Select button containing the instructions for the user.
The student may obtain downloadable
worksheets for recording data and making
qualitative and quantitative observations about that
data by clicking on one of the other primary links on
the first page. The worksheet provides boxes for
entering data and lines for student responses to
questions about the performance of the various
algorithms on each of the different data sets. The
worksheet also provides the values of n
2
and n lg(n)
for each of the sample sizes in one of the questions
and contains instructions for how to compare the
recorded data points with a multiple of either of
these two common functions. The laboratory does
not presently provide its own graphing tool, but the
worksheet provides instructions to the students on
how to use the graphing facility in Excel to visualize
comparisons between different algorithmic
approaches and between curves generated from the
data and plots of the two standard functions.
However, because there is such a wide disparity
between the range of sample sizes and the range of
comparison counts, the difference in scale between
the horizontal and vertical axes distorts the shape of
the curves and makes visual recognition of the
algorithmic behavior less transparent.
The second component directly measures the
goodness of fit of the generated data points to the
functions n
2
and n lg(n) and automatically generates
the parameters of the best fitting curve. The selected
algorithm is run over a range of sample sizes of
randomly generated data, and the best-fitting curve
for the resulting data points is determined. In this
approach, data points for ten different sample sizes
are obtained. These samples sizes range from 400 to
4000 and for each sample size the average of five
runs is used to determine the number of
comparisons. Curvilinear regression is used to
determine a best fit to one of the two standard
curves, and the parameters of this curve are
appended to an output string (Miller, 1965).
In figure 2, the interface for this second applet is
displayed. The general features are consistent with
those of the first applet. The student using this
applet need only select the sorting algorithm and the
program will run multiple sorts, collecting the data
points to be used in the regression analysis. When
the program completes, the parameters of the best
fitting curve are appended to the output string and
displayed in the text area at the bottom of the applet.
The average number of compares and the predicted
number for each sample size are copied into the
table located in the center of the applet. The only
data set type is the randomly generated distinct
integers, and the sample sizes are pre-set.
This second component eliminates the role of the
student in recording observations and evaluating the
data that he or she has collected. It effectively
automates out the traditional role of the
experimenter. Its principal value is that it provides
an immediate comparison between the average case
performance of the algorithm with the worst-case
performance (in the case of quicksort, the average
case performance) predicted by big-oh analysis. It
can also be used by the student to quickly check the
reasonableness of the results obtained from doing his
or her own calculations on random data sets.
Figure 2: User Interface for the Second Applet
A WEB-BASED ALGORITHM ANALYSIS TOOL - An Online Laboratory for Conducting Sorting Experiments
487