Quicksort is a good practical sorting algorithm: It sorts a list in place and runs in O(n lg n) time on average; however, it has a worst-case running time of O(n*n). The quicksort algorithm is also somewhat complex -- which is where visualization comes in. The applet lets you watch and control the algorithm as it sorts.

To get started, you may want to look at a pseudo-code description of quicksort. You can also take a look at the applet's source code.

Enter a list of positive integers (seperated by spaces) in the entry box at the top, then click "Reset sort display" to enter them into the display area below. They will appear as bars of varying height.

As the sort runs, either a step at a time or continuously, the bars change colors to indicate the role they are playing in the sort and the text below the bars tracks the operation being performed and the number of exchanges made.

Here's a brief description of the color scheme.

Color | Role |
---|---|

White | elements of the current partition |

Green | the pivot element of the current partition |

Yellow | pair of elements being considered for exchange |

Red | default color |

This applet is inspired by James Gosling's Java applet for visualing sort algorithms.