Shellsort Applet

This applet illustrates Shellsort with various increment sequences. Select an increment sequence (they are arranged roughly from best to worst). Then select either random or reverse input. (Worst-case input is planned for the future). Then enter N.

You can run the program to see how each phase rearranges the data. Each click of the button executes the next phase and generates a picture made popular in several animation systems (and also Bob Sedgewick's books). A diagonal line is sorted input. You need a sufficiently small N (at most 325 in a typical window) and you need to check the stop after each pass box. A running count of comparisons and data moves is kept. You can also let the program run and get these counts by not checking the box. But then you don't get the picture.

Future plans will include additional and also arbitrary increment sequences, worst-case data, and perhaps an animation (instead of step by step clicking) if I ever figure out this language.

Once you've read this intro, scroll down to get the entire applet in view.

Comments are always welcome!