The Quicksort algorithm is one of the best examples of the power of recursion. Students often find Quicksort difficult to understand at first. This is probably due to the concision of recursion. By observing the visualisation of Quicksort at work presented by this applet students should be able to more readily understand it’s
subtleties.
The main graphics window displays a representation of an unsorted array and as the Quicksort algorithm partitions the array into sub sections the animation shows how these subsections are further divided until the end goal of a sorted array is achieved.
-
In area A the Java source code for the recursive sorting algorithm Quicksort
is displayed. As the algorithm executes the current line of execution
is highlighted.
-
This animation shows pictorially how Quicksort sorts an array of integers
by partitioning the array into smaller and smaller chunks until the array
have been partitions into sub-partitions not more than one element long.
-
This is the the levels of recursion. This bar graph shows the current
level of recursion, (i.e. the number of recursive calls on the stack)
-
Gives a textual explanation of the line currently under execution
in A. Use the speed control bar (E) to slow down the algorithm so
that you can read each message and follow the "code walk through" at your
own pace.
-
This speed control allows you to speed up and slow down the rate at which
the algorithm executes.
|