Friday | 29 August, 2008
LinuxWorld.com.au
Everything you ever wanted to know about algorithms
Computer scientists look for simplicity, speed and reliability. Sometimes they find elegance
Gary Anthes (Computerworld) 25/03/2008 09:03:34

Additional Resources

Newsletter Subscription

Sign up for our LinuxWorld newsletters!
The latest Linux and related information technology news from Australia and the World.
A round up of the latest in Linux technology comprising of product reviews, HOW-TOs and editorial.
RSS Feeds

The Quicksort algorithm

In the early 1960s, British computer scientist Charles Antony Richard Hoare developed the Quicksort algorithm for sorting a list into a sequence. This one is ascending:

1. Pick any element, called a "pivot," from the list.

2. Pick in turn every other element, comparing each to the pivot. If the element is less than the pivot, put it above the pivot. If it is greater, put it below. At the end of that pass through the list, the pivot is now in its final correct place.

3. In the group of elements above the pivot, pick another pivot and repeat Step 2. In the group below the original pivot, pick a third pivot and repeat Step 2. Now three elements have been sorted into their correct positions.

4. Repeat the entire process, on successively smaller groups, until the whole list is in sequence.

LinuxWorld Member Login

 
Sponsored Links