An extensible sorting visualization program

for Macintosh and Windows

by Ken Brooks


SortWatcher came out of my teaching work in an AP Computer Science course, during the spring of 2000. It is a visualization based on the use of colors (in their natural spectral order) to illustrate sort keys; this has the result that as well as being beautiful, it very easily shows when sorting is complete or nearly complete.

SortWatcher is flexible. You can specify the number of array elements it will work on, and you can specify several aspects of the speed of execution.

It is also extensible, designed for use in a class exercise. It comes with several well-known sorting algorithms already built in, so you may simply run it to illustrate them. But its true intended use is to assign different algorithms to different individuals or teams in the class, to let each come up with their own visualized implementation of the algorithm. When all is done, they can all be assembled together into one grand improved "class showcase" SortWatcher program, with a button for each student-implemented algorithm in its button bar.

Download, all sources included. Provided to the public without restriction:

Macintosh: SortWatcher.sit (336K)
Windows: (460K) or SortWatch.exe (self-extracting, 495K)

Support for new visualized algorithms is provided through three simple classes:
VisInt stands in for int, or other type of the elements to be sorted
VisVector stands in for apvector<int>, or other type of the array to be sorted
VisIndex stands in for int, wherever int is used as an index into the array.
Each of these types can be used just like the type it stands in for, except in the constructor, where some extra visual information must be provided. The whole framework makes it quite easy to adapt a sorting program based on apvector<int>, into a visual sorting module under SortWatcher.

If you, the teacher, are assigning such an exercise, you may wish to strip out most of the provided algorithms, before making it available to students. To do so, just look in Algorithms.txt and reverse the process (Step 5) of installing an algorithm.

Compiling SortWatcher requires the Drawbox graphics package, which is freely available here.


Sparkling Light Software's home page has other delightful software
for education and fun, all mixed together.