Example 8: Sorting

A sorting algorithm puts elements in an array or a list into sorted order, either in increasing or decreasing order. Most sorting algorithms work by making comparisons between two elements.

There exist many excellent resources on sorting algorithms, both for beginner as well as expert programmers.  Mergesort and Quicksort  are two well-known recursive sorting algorithms.  The way they make recursive calls and merge the returned sorted sequence represents how many other recursive algorithms work.  Below are related sites:

Mergesort

Quicksort

Advanced Reading