Sorting Demonstrator -------------------- See COPYING for details on distributing this program. 1. Installing sortdemo See the INSTALL file for installation instructions. 2. Running sortdemo sortdemo takes three arguments. (a) Sort type sortdemo 0.2 supports the following sort types s, selection : selection sort i, insertion : insertion sort b1, bubble1 : bubble sort b2, bubble2 : bubble sort with a flag b3, bubble3 : two way bubble sort (shaker sort) with a flag b4, bubble4 : enhanced two way bubble sort with a flag q, quick : quick sort (b) Initial data This describes the nature of the initial list s, sorted : sorted re, reverse : sorted in the reverse order ra, random : random as, almost-sorted : almost sorted ar, almost-reverse : almost reverse (c) Initial list size For example, to do a bubble sort with a flag (b2) for a random data set of 20 items, type sortdemo b2 random 20 3. Text output Two files (by default unsorted.d and sorted.d - see sortdemo.h), will be written that contain the sorted and unsorted data. 4. Graphic output Each step of the sorting will be written to a file starting from sort00000.gif and go on with the names sort00001.gif, sort00002.gif etc. The currently active item(s) will be shown in one color and swappings in another. Also, in some cases, only a part of the list is highlighted (e.g. - in quick sort, the items not belonging to the current list is de-highlighted). If you are impatient to see the result, type animate -delay 100 sort*.gif to see how the sorting routine is going. If you want to produce an animated gif (say, to publish on the web), use convert utility convert -delay 500 sort*.gif quicksortanimation.gif Notice that you should have ImageMagic to run animate and convert commands. Since animate and convert are taking too much memory, it would be a good idea to convert the series of image files to an mpeg. One simple way to do this is to use the MPEG video decoder and encoder. It also comes with RedHat Powertools. !!! W A R N I N G !!! Don't make the list size too large. The convert and animate program may glob a large amount of memory and may disturb the other processes going on. Generally 20-30 seems to be okey with 64 MB. 5. Common Pitfalls Always remove the old gif files before running sortdemo. 6. sortdemo Home Page Visit http://www.lklug.pdn.ac.lk/software/sortdemo/ for more details and examples. 7. Work in progress a. To add lists with gaussian random variables b. To demonstate the use of tempory variables ------------------------------------------------------------------------ Anuradha Ratnaweera Dept. of Computer Sciences Faculty of Engineering University of Peradeniya Peradeniya 20400 Sri Lanka Send your comments to anuradha@cs.pdn.ac.lk