I also have a better version of sortdemo called showsort. It is based on GTK, and has a nice GUI. You can download it here. Currently it demonstrates the Bubble sort.
Now back to the old program ;)
Sortdemo is a program to visualize various types of sorting algorithms. It generates a sequence of image files, that can be converted to an animation suitable for demonstrations. The following animated gif files, showing quick sort and bubble sorts, were generated using image sequences generated with sortdemo. For example, the file quick.gif.gz was created with
sortdemo q random 30 convert -delay 500 sort*.gif quick.gif gzip quick.gif
These files are gzipped. Use gunzip to uncompress them. If you are not using Unix/Linux, use Winzip or something similar. To view the images, use any gif viewer which supports animated gifs.
If you are not sure if there is a gif animator available on your system, try downloading the mpeg files below.
To view the quick.gif, type
gunzip quick.gif.gz animate -delay 500 quick.gif
or simply
animate -delay 500 quick.gif.gz
To view images one by one, type
display quick.gif.gz
and select next/former after right clicking on the image.
Here are some mpeg animations of the quick sort, and a bubble sort variation.
Sortdemo version 0.2 is now available.
Sortdemo is also available from metalab (formerly sunsite).
Sortdemo is linked against the famous gd graphics libraries for gif/png support.
Gd library comes with many linux distributions including Debian and RedHat and probably you have already installed them on your system.
If you are running Debian/GNU Linux you can verify this by the commands
dpkg -l libgd1g dpkg -l libgd1g-dev
Under RedHat Linux you can use
rpm -q gd rpm -q gd-devel
If you don't have these packages installed, you will have to install them. If there are difficulties, consult a local expert.
Upto about gd version 1.6, it supported gif and after that they moved to png, giving up gif. Sortdemo configure script tries to detect the availability of gif support by looking for gdImageGif routine in the -lgd library. If this test fails, it thinks that the gd version is newer and removes the line '#define HAVE_GDIMAGEGIF' from the file config.h, so that the compiled sortdemo executable will support png. Hoewver, if you do have a gd version that supports gif and if the configure script fails to detect that, try adding the line
#define HAVE_GDIMAGEGIF
to config.h file AFTER running configure script.
We have noticed that this is not necessary in almost all the cases.
An internal version 0.11 was released with many enhancements added by Vishvanath Ratnaweera. New features in this version included
This version was not released to the public.
This is the first release of sortdemo. It supports four sort types, three initial data types and gif output.
If you have problems downloading these files under linux, use wget program with the option -t0 (infinite timeout). For example to download the quick.gif.gz above, type
wget -t0 http://www.lklug.pdn.ac.lk/software/sortdemo/quick.gif.gz
If the connection is lost before the file is downloaded, wget will automatically restore the connection and will continue from where downloading was stopped.
Sortdemo is developed by Anuradha Ratnaweera. See the README file of the source tarball for contact information.