This is intended as a demonstration page for an introductory programming course, showing the step-by-step
progress of various sorting algorithms. There are many other pages that have similar kinds of
demonstrations (see the links on the right), but I feel that my approach is valuable as a complement to those
pages.
The source code shown (below on the right) is a "C-like" language, except that
(a) I have omitted details such as variable declaration and typing, and
(b) I use a pseudo-command "swap" to accomplish swapping two entries in the array.
(I also used a pseudo-command "copy" in the merge-sort algorithm.)
Also note that, because this page is intended as an educational tool, in some cases I sacrificed efficiency for brevity and (I hope) clarity,
esp. in the two quicksort algorithms.
This is a work-in-progress, and I am open to suggestions, criticisms, or fawning praise. I should also
acknowledge that I blatantly pilfered some of the sorting source code from a variety of sites (marked with asterisks in the links list).
Animated Algortithms: Sorting (David Howard) — a different approach to visualizing the sorting process; some of these are fun to watch (try "Ordered/Heap", or "Reverse/Shell").
Updates: (3/25/2008) Interface changed, and features added based on feedback from H.W. Lang and Dominique Thiebaut;
(10/16/2009) Correction to shell sort, interface tweaks, links updated.
(12/22/2011) Improved (leaner) Web page design.
This is intended as a demonstration page for an introductory programming course, showing the step-by-step progress of various sorting algorithms. There are many other pages that have similar kinds of demonstrations (see the links on the right), but I feel that my approach is valuable as a complement to those pages.
The source code shown (below on the right) is a "C-like" language, except that (a) I have omitted details such as variable declaration and typing, and (b) I use a pseudo-command "swap" to accomplish swapping two entries in the array. (I also used a pseudo-command "copy" in the merge-sort algorithm.) Also note that, because this page is intended as an educational tool, in some cases I sacrificed efficiency for brevity and (I hope) clarity, esp. in the two quicksort algorithms.
This is a work-in-progress, and I am open to suggestions, criticisms, or fawning praise. I should also acknowledge that I blatantly pilfered some of the sorting source code from a variety of sites (marked with asterisks in the links list).
Updates: (3/25/2008) Interface changed, and features added based on feedback from H.W. Lang and Dominique Thiebaut; (10/16/2009) Correction to shell sort, interface tweaks, links updated. (12/22/2011) Improved (leaner) Web page design.